I started working on a project today that uses the MySQL relational database to save data on the back-end. One of the packages available for Fedora 10, my current desktop OS, is the mysql-gui-tools package. This includes the MySQL Administrator and MySQL Query Browser programs. I had those already installed, but after a few minutes I knew that the Query Browser just wasn’t going to work for me. I kept trying to copy queries into the little window, and errors were getting into it somewhow. And even if that weren’t happening, I couldn’t get it to resize and not being able to look at more than a couple lines at a time was driving me nuts. So I hopped over to OTN and grabbed Oracle SQL Developer. SQL Developer was built with Oracle in mind but it can connect to a variety of database systems.
I downloaded the rpm and installed it – which took all of about a second. I ran it from the menu item added to my launcher’s dev menu but it wouldn’t start. I switched over to konsole and ran it from there. It hadn’t been able to find java on its own. It said that if I told it where java was at then it would save that value in ~/.sqldeveloper/jdk. I tracked down the correct value (/usr/local/jdk1.6.0_11 on my box) and fed that in. SQL Developer started though it threw an error about the jdk file not being there or something. I knew what that meant, so I shut it down and created the directory and added a holder for the file.
The next time I started sqldeveloper from the command line it asked again and I gave it the directory but this time without any errors. I shut it down and it started just fine from the launcher. I did a cat on the file and it is just a single line with the path – so in the future anyone using sqldeveloper on Fedora 10 could just create the file and fill it in themselves. It shouldn’t be that way – but for me it was.
Once I had SQL Developer running – I just needed to tell it where the MySQL driver was. It’s easy to download from the MySQL folks (It is right here.) but I knew I had already installed it back when I set up the machine. I just wasn’t sure where it was. So I hopped over to my package management program and searched on mysql. I found the full package name “mysql-connector-java” and then from konsole as root queried for files installed with that package.
rpm -ql mysql-connector-java
This showed that the file I wanted was /usr/share/java/mysql-connector-java.jar With that infomration I just needed to go into SQL Developer and select Tools -> Preferences -> Database -> Third Party JDBC Drivers. I clicked the “Add Entry” button and browsed to the jar file. I clicked “OK” and that was it. Now when I create a new connection in SQL Developer I have a tab for MySQL databases. Very nice. I will miss watching that dolphin swim though – but not enough to go back.