Continuing my adventures in this strange and (mostly) wonderful new world of Ubuntu…
Now I’ve managed to get Oracle XE to behave itself on Ubuntu, it’s time to install SQLDeveloper.
Note – if you’ve stumbled across this post whilst looking for instructions for installing the latest version of SQLDeveloper ( currently version 4), you can find instructions here.
The aim is to :-
1)Install SQLDeveloper so it’s working ( i.e. can connect to my XE database)
2)Setup a Menu item so I don’t have to mess about running a shell script to start it every time.
So, deep breath…
Checking Installation Requirements for SQLDeveloper
Hang on, wouldn’t the first step be getting SQLDeveloper ? Um, that’s what I thought, but years of Oracle installations have taught me that it’s normally a good idea to have a read through the installation requirements, just in case. I found them here.
A couple of points to note the SQLDeveloper Release Notes :-
- The required JDK version
- Unlike Windows, SQLDeveloper isn’t supplied with it’s own JDK, which means that you have to make sure the one on your system is compatible with the tool.
That’s easy enough. Just open a terminal session and type :-
The output I got on my still fairly vanilla Ubuntu installation was :-
java version "1.6.0_0" OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-3ubuntu1) OpenJDK Server VM (build 14.0-b16, mixed mode)
The release notes for SQLDeveloper 1.5.5 does say it’ll work with Java 6, but only patch 3 and above. So, looks like I’m going to have to upgrade the Java version.
NOTE – at this point it’s worth mentioning that I initially managed to install SQLDeveloper without upgrading the JDK and to get it to start and connect to XE.
This was achieved by adding the following line to sqldev_home/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf :-
Where sqldev_home is the directory under which you’ve installed SQLDeveloper.
However, that’s all I did – fire it up and connect to the database. I don’t know what bits of the tool don’t work with this JDK version.
So, to be on the safe side I decided to update the JDK.
Updating the JDK
Back into Synaptic Package Manager…
In the Quick Search, type in Java.
The package we’re looking for is sun-java6-jdk
Mark it for download and let Synaptic do it’s thing ( it’ll install about half a dozen related packages).
Once it’s finished, you’ll then need to change the java version that the OS uses by pointing it to the one you’ve just downloaded.
Doing this is comparatively straight forward. The instructions I followed are part of the Ubuntu Documentation at .
Essentially, what you need to do is Open a Terminal session and do the following :-
sudo update-java-alternatives -l
This will give a list of the available java versions on your system.
In my case, the list I got was :-
java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk java-6-sun 63 /usr/lib/jvm/java-6-sun
The version I’ve just downloaded is java-6-sun ( if you’re not sure, just do
ls -l /usr/lib/jvm
and check the date of the symbolic links listed by update-java-alternatives).
To make this the current jdk version :-
sudo update-java-alternatives -s java-6-sun
I got a couple of errors at this point – to whit :-
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so. update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so.
OK, it’s the same error, but it came up twice. However, when I checked the Java version again, it seemed to have worked :-
java -version java version "1.6.0_15" Java(TM) SE Runtime Environment (build 1.6.0_15-b03) Java HotSpot(TM) Server VM (build 14.1-b02, mixed mode)
That error is apparently a bug connected with the Java package supplied by Sun.
The bug number is 226911 on launchpad .
As far as I can tell, it hasn’t broken anything, so I’m not going to worry about it for now.
Trawling through Synaptic Package Manager, you can see that there is something called sqldeveloper-package which is described as “Oracle SQL Developer Debian Package Builder”.
This package is available from the same repository as I added to get XE.
Not sure about this Package Building bit, and after some cursory reading, I decided that I’d rather download direct from the Oracle site.
Click on the download link on the oracle site ( the URL above).
The download option we need is Oracle SQL Developer for other platforms.
Firefox will save the file to /tmp.
Now we need to move it to a suitable location to create the sqldeveloper home.
All in all, /opt looks to be the best place to put this.
Back into Terminal :-
mv /tmp/sqldeveloper.zip /opt/.
So, with sqldeveloper.zip in place :-
This will create the sqldeveloper home directory structure.
Finally, we just need to run the following :-
cd /opt/sqldeveloper sh sqldeveloper.sh
You may get prompted for the location of the JDK. If so, just specify
The script should then look for
, find it, realise it’s the correct JDK version, and SQLDeveloper will start.
The first time you run SQLDeveloper, it’ll ask you about importing settings. This is only relevant if you have a previously installed version.
Connecting to the database
First off, you need to make sure that your database is up and running.
In SQLDeveloper Go to the File menu and Select New
Select Connections from the tree in the left hand pane and then Database Connection in the right hand pane.
Enter the following in the New/Select Database Connection dialog :-
Connection Name– the name of the connection that you want to appear in the SQLDeveloper Connections list.
Username and Password should be the credentials for the database user you want to connect as
(Note – if you click the Save Password checkbox, SQLDeveloper will remember it, otherwise you’ll be prompted for it each time you use this connection).
Role – leave this as Default for now
Connection Type – change this to TNS.
If XE ( and more to the point, the TNS listener) is up, then the display will change to show a drop-down list called Network Alias, containing all of the entries in the tnsnames.ora file.
Click the Test button to make sure that you’ve input the correct information and you should get a success message.
Click Save and the connection should now appear under the Connections node in the main SQLDeveloper tree.
UpdateI subsequently had a problem with the TNS connection. See here for a workaround.
Adding a Menu Option for SQLDeveloper
I don’t really fancy running the shell script manually every time I want to run SQLDeveloper, so I’d like to add it as a menu item.
To do this, we need to change the permissions on the script first :-
sudo chmod 755 sqldeveloper.sh
This will allow you to execute the file as your normal user from the menu.
Adding the menu item itself is something you can do easily through the Ubuntu desktop :-
- Go to the System menu and select Preferences then Main Menu.
I chose to put SQLDeveloper on the Programming Menu ( click the appropriate menu in the left-hand pane).
- Click on New Item
- You should then be asked to specify an icon. There are two icon files in /opt/sqldeveloper, pick whichever you fancy ( they’re both the same)
In the dialog, enter the following :-
Type is Application
Name – SQLDeveloper 1.5.5
Command is /opt/sqldeveloper/sqldeveloper.sh
Once you Close the Main Menu window, you should be able to see the new menu Item for SQLDeveloper under the Applications/Programming Menu.
Click on it, and it should start SQLDeveloper.
And the adventure continues !