Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Starting with MySQL Connector J - JDBC driver
Starting with MySQL Connector J - JDBC driver [message #639581] Tue, 16 November 2010 21:42 Go to next message
Mark is currently offline Mark
Messages: 4
Registered: December 2009
Location: VT, USA
Junior Member
Hi,
I am new to this, so this is my first time. I am using the Eclipse IDE, and I have not set up any classpath variable for the use of it (on WIndows 7). I am trying to install/register/use a mySQL JDBC driver on this machine, to connect to a mySQL database I have on the 'net.

So far, I have a copy of the download from
http://dev.mysql.com/downloads/connector/j/
Which contains a JAr file inits root directory, readmes, and a source dir and docs dirs with many files. There are for example many files in the src\lib dir, such as JARs there. Well,I got a copy of mysql-connector-java-5.1.13-bin.jar and put it into my jre6\lib dir, and tried adding that dir to a system CLASSPATH (none there before), and I cannot show any registered driver coming from DriverManager...

Enumeration driverList = DriverManager.getDrivers();
while (driverList.hasMoreElements()) {
Driver driverClass = (Driver) driverList.nextElement();
s = s + " "+driverClass.getClass().getName();

Enumerated list of drivers:
sun.jdbc.odbc.JdbcOdbcDriver

I am having trouble with how to install/register this JDBC driver, which would be my first. Any help is appreciated.

TIA -
Mark

[Updated on: Tue, 16 November 2010 21:42]

Report message to a moderator

Re: Starting with MySQL Connector J - JDBC driver [message #639593 is a reply to message #639581] Wed, 17 November 2010 00:17 Go to previous message
Mark is currently offline Mark
Messages: 4
Registered: December 2009
Location: VT, USA
Junior Member
Hi,
Got it! I got the mysql driver to register in eclipse when I added it as an external JAR (project LIBs), and maybe with executing the line...
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
(which is just for getting it to register itself).

I also got my db name straightened out. I needed <server>_<database> as the database name, or whatever 'server' is. I got the connect and got data from it. URL as:
jdbc:mysql://<myhost>/<server>_<database>
(plus userID and pwd args)

Q: Can I get this connection with security? Like SSL? To avoid passing userId/Pwd along (openly)?

Cheers,
Mark

[Updated on: Wed, 17 November 2010 00:18]

Report message to a moderator

Previous Topic:Finding out changes to methods?
Next Topic:Can't prevent deletion of launch configurations
Goto Forum:
  


Current Time: Fri Aug 29 22:29:00 EDT 2014

Powered by FUDForum. Page generated in 0.01532 seconds