Upgrading to SQLDeveloper 3.0 on Ubuntu

My new year’s resolution that no alcohol will pass my lips is in no way connected to the fact that the only drink left in the house is half a bottle of cooking sherry that I’ve had for ages and really don’t like the look of right now.

As I’ve struggled through the hangover haze of a New Year’s Eve spent being corrupted by my better half, I’ve made a number of discoveries :

  • I now know why Belgian beer is only served in small glasses
  • the more you drink, the less it matters about the accuracy of your cocktail mixing skills
  • don’t try and install SQLDeveloper on Ubuntu if you’ve got a hangover

I installed SQLDeveloper 1.5.5 some time ago and I’ve now decided to take the plunge and have a go with SQLDeveloper 3.

Update – if you’ve stumbled across this looking for instructions on how to install SQLDeveloper4, then this may help.

Now, to call it an “Upgrade” is a slight misnomer – you really need to install each version of SQLDeveloper in it’s own right. The only difference is that SQLDeveloper will look for older versions of itself and offer you the chance to import any connections or other modifications that you may have made in those versions.

The system I’m using is Ubuntu 9.10 desktop ( 32-bit) running Oracle XE ( no Oracle client).
I already have a JDK installed.
Having reviewed the Release Notes, I know that this version of SQLDeveloper requires Java JDK version 1.6_11 or higher to run, so the first step is to check out what Java version I’m running and update it if necessary.

The Vexed Question of Java Version Numbers

I don’t know if it’s just me, but don’t you remember a time where a piece of software only had one version number ? This practice seems to have rather fallen out of fashion. Let’s take Java as a completely random example.
Java 6 is actually Java 1.6.
In Oracle’s documentation Java 6 update 11 is Java 1.6_11.
In Synaptic Package Manager it’s Java 6.11_0

Let’s have a look on the command line :

$ java -version 
java version "1.6.0_22" 
Java(TM) SE Runtime Environment (build 1.6.0_22-b04) 
Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode) 

After much head-scratching and an introvenous injection of caffeine, I’ve concluded that 1.6.0_22 is actually Java 6 Update 22.

If you do need to install or update a JDK :

  1. Go into Synaptic Package Manager
  2. In the Quick Search type : sun-java6-jdk

If it’s not already installed, just mark it for installation and let Synaptic do it’s thing.
Once this is completed, you need to re-point the system to use the new JVM :

$ sudo update-java-alternatives -l 
java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk 
java-6-sun 63 /usr/lib/jvm/java-6-sun 
$ sudo update-java-alternatives -s  java-6-sun

Incidentally, it doesn’t matter which of the java packages I used in the update-java-alternatives command, the end result is that the symbolic link pointed to by /usr/bin/java ( /etc/alternatives/java) points to the JRE directory (even in the in the JDK). The upshot is that SQLDeveloper will complain about the lack of a J2SDK when you come to run it for the first time. Honestly, there’s no pleasing some software. I’ll come onto the workaround for this in a bit.

Getting SQLDeveloper 3

OK, let’s trot along to Oracle and download the latest and greatest SQLDeveloper ( 3.0 Early Adopter at the time of writing).

  1. Point your browser here
  2. Click on the Download EA2 option
  3. Accept the License Agreement

A couple of points to note at this stage.
First – we need the “SQLDeveloper for Other Platforms” and NOT the Linux RPM.
Second – someone at Oracle has obviously had a similar New Year celebration to me as all of the version numbers on the installation instructions are still 2.1.1.64.45.
For the record, the correct version number is 3.0.02.83

Anyway, download the zip file. In my case I’m using Firefox and so the file is downloaded to $HOME/Downloads.

Installing the New Version

My currently installed version of SQLDeveloper is installed under /opt/sqldeveloper. I don’t want to overwrite this at the moment for a number of reasons. Not least of these is that I want to migrate all of my connections, add-ons etc to the new version of SQLDeveloper. Another fairly major consideration is that I want to make sure this all works first.
So, I’m going to create a separate directory under /opt, copy the zip to that directory and then uncompress it.

$ cd /opt
$ sudo mkdir sqldeveloper3.0.02.83 
[sudo] password for mikes: 
$ ls -l 
total 74908 
drwxr-xr-x 13 root  root      4096 2010-01-03 01:25 sqldeveloper 
-r--------  1 mikes mikes 76614575 2009-12-13 19:39 sqldeveloper-1.5.5.59.69-no-jre.zip 
drwxr-xr-x  2 root  root      4096 2011-01-01 15:55 sqldeveloper3.0.02.83 

$ cd sqldeveloper3.0.02.83
$ sudo cp $HOME/Downloads/sqldeveloper-3.0.02.83-no-jre.zip . 
$ ls -l 
total 127764 
-rw-r--r-- 1 root root 130694166 2011-01-01 15:58 sqldeveloper-3.0.02.83-no-jre.zip 
$ sudo unzip sqldeveloper-3.0.02.83-no-jre.zip 

Once everything is unzipped, go to the newly created sqldeveloper directory and change the permissions of the sqldeveloper.sh file to be executable

$ cd sqldeveloper
$ ls -l sqldeveloper.sh
-rw-r--r-- 1 root root 71 2010-11-22 15:46 sqldeveloper.sh 
$ sudo chmod a+x sqldeveloper.sh 
$ ls -l sqldeveloper.sh 
-rwxr-xr-x 1 root root 71 2010-11-22 15:46 sqldeveloper.sh 

Ready to run it ? Not so fast. If we run it now, it’ll complain that it can’t find a JDK (as mentioned earlier).
So, we need to add a line to the sqldeveloper.conf in /opt/sqldeveloper3.0.02.83/sqldeveloper/sqldeveloper/bin :

$ cd /opt/sqldeveloper3.0.02.83/sqldeveloper/sqldeveloper/bin
$ sudo gedit sqldeveloper.conf

The line we want to add tells sqldeveloper.sh to skip the check for the JDK ( we already know we’ve got an appropriate version) :

SetSkipJ2SDKCheck true

Now, make sure the target database is running and …

$ cd /opt/sqldeveloper3.0.02.83/sqldeveloper
$ sh sqldeveloper.sh

At this point you will get a number of Java errors which seem to be to do with not being able to find the SQLDeveloper data modeller. Not surprising since we haven’t installed it. Fortunately, these errors are not fatal and the tool should start with no problem.
The first thing it will do is pop up this window :

Save yourself some hassle and say Yes

Just say yes and all of your connections and any user defined extensions, reports etc will also be imported.
SQLDeveloper then fires up and all should be OK…but just connect to the database and run a simple query to be sure.

Adding it to the Menu

Finally, I want to add the new version to the Programming Menu.

  1. On the desktop go into System / Preferences / Main Menu
  2. Navigate to the Programming Menu and click on New Item.

In the dialog, enter the following :
Type – Application
Name – SQLDeveloper 3.0.02.83
Command – /opt/sqldeveloper3.0.02.83/sqldeveloper/sqldeveloper.sh

The icon to use is in /opt/sqldeveloper3.0.02.83/sqldeveloper/sqldeveloper/doc.

The final step is to make sure that you have all of the appropriate environment variables set ( which should be the case if you have an existing version of SQLDeveloper) – re-start the machine.
You should be able to run SQLDeveloper from the menu and also, still be able to connect to the database without any issues ( provided the database is up, of course – don’t tell me you’ve been indulging as well !)

If you do happen to hit any issues with a missing ocijdbc11, then have a look here.

Right, that’s quite long enough to keep a New Year’s resolution. I’m off to the pub.

About these ads

3 thoughts on “Upgrading to SQLDeveloper 3.0 on Ubuntu

  1. Excellent guide, thanks a bunch! Work perfectly on 11.04, it didn’t even puke with any Java errors.

    I was kinda hoping the v.3 would be a little bit lighter and faster than previous releases, but it seems it’s even heavier on the resources.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s