Skip to main content



      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
Eclipse UserFriend
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] by 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
Eclipse UserFriend
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] by Moderator

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


Current Time: Tue Jul 01 18:36:26 EDT 2025

Powered by FUDForum. Page generated in 0.23977 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top