Using Oracle's SQL Developer from Mandriva

30 November -0001
by Justin Klein Keane
Aug 28, 2006

This article was written specifically for a Mandriva workstation, but the principles are the same so it applies to almost any Linux distribution. This article provides instructions to get SQL Developer working and connecting to a remote Oracle host behind a firewall (i.e. not accepting inbount port 1521 tcp connections) by utilizing an SSH port forwarding tunnel.

This article assumes a three part setup. The first part is the installation of a java runtime environment (JRE) as part of a full installation of the java development kit (JDK). The JRE is required for Oracle's SQL Developer to work. Once the JRE is properly installed the second step is to the installation is downloading and installing Oracle's SQL Developer (formerly project Raptor). Once SQL Developer is installed the third step is establishing the port forwarding tunnel.

Step 1: Instructions for Installing the JRE

First download the self extracting rpm from the Sun site (http://java.sun.com). Be sure to download the self extracting RPM version for Linux. Extract this file using:

./jdk-1_5_0_0-linux-i586.rpm.bin

and then move the resulting RPM to /usr/java.

'su' to root and issue the RPM install command:

rpm -ivh jdk-1_5_0_07-linux-i586.rpm

This installs the rpm. Note that when you run the first bin extract it may install the RPM. You will have to uninstall the RPM using:

rpm –erase jdk

as root to remove it, then follow the above instructions (move the RPM then install it).

Installing SQL Developer

Once the install is complete you can install Oracle's SQL Developer. Download the necessary package from Oracle (at the time of this writing the download can be found at http://www.oracle.com/technology/products/database/sql_developer/index.html), unzip and untar it using:

unzip sqldeveloper-1557-no-jre.zip

This should create a full directory structure under a new directory called sqldeveloper. You're going to have to add executable bits on the contents of this directory in order to run the program. The easiest way to do this is with:

chmod u+x sqldeveloper/ -R

Next you can fire up the sqldeveloper by changing into the directory and issuing:

./sqldeveloper

You'll probably have to input the directory of your newly installed Java Runtime Environment, which will be something under /usr/java where you just installed it.

Instructions for Connecting Remotely to an Oracle Server

Often times you may find that an Oracle server is situated behind a firewall. In these circumstances it is usually easiest to tunnel a connection to the remote server. These instructions detail how to accomplish this from a remote Linux host (although they would work for a windows host as well).

First you must create a tunnel so that your Oracle connection request appears to be originating from inside the remote network. You may be able to accomplish this by establishing an SSH connection with the remote Oracle host, but at other times you may have to utilize an alternate SSH host. To create the tunnel you will need to bind a local port to forward to 1521 on the destination Oracle server. Depending on your set up you may need to be root to bind ports. To establish this connection:

sudo ssh -L 1521:target.oracle.host..tld:1521 username@target.ssh.host.tld

Of course the username and the hostname may vary. You'll have to enter your local user account password for sudo and then the account password on the target SSH host. Next fire up SQL Developer. You need to add a new connection and fill in the following:

Connection Name:  Whatever you'd like
Username:  the oracle username
Password:  the oracle password
Basic:
	Hostname:  localhost
	Port:  1521
	[x] SID:  the target SID 

Click the button to test the connection and you should be good to go.