Data Management

Configuring SQL Developer for MySQL

I rant against Oracle products a lot in this blog, but I have to admit I actually like a few of their products. One of them is SQL Developer. Strangely though, the feature I kind of like best is that SQL Developer can connect to non-Oracle databases like MySQL.

I rant against Oracle products a lot in this blog, but I have to admit I actually like a few of their products. One of them is SQL Developer. Strangely though, the feature I kind of like best is that SQL Developer can connect to non-Oracle databases like MySQL. This makes it a handy little multi-database GUI -- you can have sessions in one UI open against different vendors' databases.

But, like so much Oracle software, it doesn't quite work the way you'd like right out of the box. There is a screen where you can configure a MySQL connection, but there is no driver included to actually make the MySQL connection.

Connection screen

I assume it's a legal issue because, even though SQL Developer is free, it's not open source. But the MySQL JDBC connector is very much open source covered by the GPL. I don't think Oracle could distribute the connector unless they made SQL Developer open source as well.

Setting it up 

First, download the version of the connector you want from the MySQL site. Unzip and place the JAR file in whatever directory you want. I just drag it into the SQL Developer folder so everything stays together in one place.

Now start SQL Developer and click on the Tools:Preferences menu; this should open the Preferences dialog box.

Preferences dialog box

Click on the Add Entry button, which brings up a Select Path Entry dialog box. Navigate to wherever you've stored the JAR file and select it to load into Preferences.

Selet Path Entry

Now you can set up connections to Oracle and MySQL databases. That's it -- easy peasy.

4 comments
MariposaLibre
MariposaLibre

I want to thank you for this article - after adding this dependency to JAR file with driver "automagically" a new tab 'MySQL' in "New / Select Database Connection" showed up!

vpa2013
vpa2013

Hello, Thank you for this tutorial! I'm having an issue using transactions though I'm using sqldeveloper 3.0.0.4 with connector/j mysql-connector-java-5.1.16-bin.jar I want to be able to do transactions. I'm just used to playing around with queries and being able to rollback at any point. I've tried disabling auto-commit options in sqldeveloper but it's overriden at driver level I can't event change it explicitely in the session set autocommit off -> Set autocommit script command forced off, as connection level autocommit is on I've read that innodb database had a strange way of handling transactions from multiple sources (see http://forums.oracle.com/forums/thread.jspa?messageID=1658148&) so i gave up trying to disable auto-commit and settled for using explicit transaction declaration when needed : start transaction; ... commit; but at "start transaction" i get Error report: Unable to open file: "TRANSACTION.sql" Any idea how to do transactions or disable the auto-commit with this driver? Thanks

dermdaly
dermdaly

I thought that Oracle being Oracle, they wouldn't do something like this. How progressive. Well done SQL Developer TEAM!

RexWorld
RexWorld

Somebody from Oracle's SQL Developer team contacted me and said that the next version of the product will simplify the process even further. It will make the MySQL JDBC drivers available thru the automated update mechanism. So instead of having to go thru the steps I outlined above, you'll just be able to make a couple clicks thru the update screens and it will install the MySQL JDBC JAR automatically.