Sunday, September 19, 2010

Install MySQL Connector/J for use from Eclipse

I already had a JDK, Eclipse, and MySQL installed but I needed to install the MySQL Connector/J so I could use it with the Eclipse SQL Explorer plugin to access the database with JDBC instead of the JDCB-ODBC bridge.  There are many ways to get the job done.  Here is what I did:

First I downloaded MySQL Connector/J; created a directory “C:\Devel\Java\JRE\ext”; extracted the binary jar for the driver from the download and copied the  mysql-connector-java-3.1.14-bin file into “C:\Devel\Java\JRE\ext”.

Started Eclipse; in the preferences dialog edited the settings for the Installed JREs.

clip_image002

Specifically, I used the “Add External JARs…” to add the MySQL connector I put in C:\Devel\Java\JRE\ext.

First select the installed JRE you want to edit.

clip_image004

Next “Add External JARS…”clip_image006

Then you should see the driver show up in the “JRE system libraries” list.

clip_image008

Now I have a working MySQL Connector/J JDBC driver ready for use with Eclipse projects. Yay!

4 comments:

Eli said...

thank u its really was helpful

Amit Borkar said...

Thanks for the steps. Really helpful

Steven said...

Thanks - exactly what I was looking for!

jhunovis said...

Almost two years later, it is still a very helpful article, as the configuration dialog of SQL Explorer is far from being intuitive. Thank you! I linked your article from a short how-to I wrote about creating and filling tables with MySQL.