Sunday, September 23, 2007

SQLDeveloper setup trick

by Eduardo Rodrigues

Yes. The title of this post really is SQLDeveloper. I did not write it wrong. But what it has to do with Java? Well, the answer is simple: Oracle SQLDeveloper is a very useful and interesting database tool for developers and is build in Java. It's like an IDE for Oracle DB and has somethings in common with JDeveloper. For those who are now curious, Oracle SQLDeveloper may be downloaded from Oracle Technology Network. I use it and certainly recommend it for developers (not for DBAs).

With all that said, let's go directly to the point...

One of the things SQLDeveloper has in common with JDeveloper is how its setup is done. However, in it's latest versions (1.2.1 was the latest version at the time this post was written), SQLDeveloper has a small setup trick.

As you will notice, SQLDeveloper does not come with an installer program. All you have to do is uncompress the downloaded zip archive and run sqldeveloper.exe located in its root directory. You may choose to download it with a bundled JDK 1.5.0_06 or without it and then set it up to use a more recent JDK (version 6 is already certified). Looking inside the expanded directory tree, you'll find an "<SQLDeveloper_Install_Dir>/SQLDeveloper/bin" subdirectory containing the files "sqldeveloper.conf" and "jdk.conf". The former is the setup starting point and the latter is empty when you download SQLDev without the bundled JDK.

Edit this file and notice the "IncludeConfFile" directives. The first one points to an "ide.conf" file located in "<SQLDeveloper_Install_Dir>/jdev/bin" subdirectory. This file works for SQLDev much like "jdev.conf" does for JDev. Some important things you may setup there is Java Heap maximum size and, specially for Windows users, the keepWorkingSetOnMinimize system property which avoids SQLDev's working memory to be paged out by Windows when you minimize it (believe me, you want this system property set). You may set those like this:

# setting maximum heap to 256 MB
AddVMOption -Xmx256M

#setting keepWorkingSetOnMinimize
AddVMOption -Dsun.awt.keepWorkingSetOnMinimize=true

If you look at the same subdirectory, you'll find another "jdk.conf" file, this time with the following content:

###############################################################
# Oracle IDE JDK Configuration File
# Copyright 2000-2006 Oracle Corporation.
# All Rights Reserved.
###############################################################
#
# Directive SetJavaHome is not required by default,
# except for the base install, since the launcher will
# determine the JAVA_HOME. On Windows it looks
# in ..\..\jdk, on UNIX it first looks in ../../jdk.
# If no JDK is found there, it looks in the PATH.
#
# SetJavaHome C:\Java\jdk1.5.0_04

Because SetJavaHome directive is commented out, this file has pretty much the same effect as the empty one located in "<SQLDeveloper_Install_Dir>/SQLDeveloper/bin" subdirectory. In this case, the application will look for the bundled Java Runtime Engine which should be located in "<SQLDeveloper_Install_Dir>/jdk" subdirectory. And this is the trick. Which of the "jdk.conf" files is the correct one? The answer is: the empty "jdk.conf" in "<SQLDeveloper_Install_Dir>/SQLDeveloper/bin" subdirectory. So, if want or need to specify what JDK should be used to run SQLDeveloper, you must edit this file and add the following:

# tipical setting for Windows
# (you don't need to enclose the path with double quotes)
SetJavaHome C:\Program Files\Java\jdk1.5.0_12

In order to confirm your settings, just open the "About" window and select the "Version" tab:



There you may check what Java is being used and, looking at the "Properties" tab, you may check all other settings.

That's it. Best regards to all!

12 comments:

Unknown said...

I found that the java home path is set at the end of my sqldeveloper.conf file.

Any java home path that I add to the empty jdk.conf would only be overwritten by what was set in sqldeveloper.conf.

Larry Baugh said...

Just wanted to offer a big thanks for posting this. I've been getting more and more annoyed lately at a garbled text issue & performance issues with SQL Developer. The solutions identified, along with changing the SQL Dev Environment Look and Feel to 'Windows' instead of Oracle, definitely seems to help a good bit on my Vista machine. It made my day.

Anonymous said...

I agree with Larry. Thank you!!

dunkert said...

one comment ASSSSOMMMME!
Finally I got this thing solved, big thanks

Alvin said...

Amazing!! Thanks! It definitely solved my problem

Luke said...

This was driving me crazy THANK YOU!

Unknown said...

One thing that will help with Windows 7...start the program the first time as Administrator. Then your edits will be saved for the Java location. Afterwards, you can run as normal.

Anonymous said...

Thanks a lot! I was trying to figure out how to set the java heap size and this did the trick.

Nigel Vining said...

Thanks Les, that had been driving me nuts for weeks!!!! ... then just today I randomly right clicked on the .exe and notice 'run as administrator' ... and the lightbulb came on :p Cheers

Anonymous said...

Thanks a lot!

Anonymous said...

Thanks a ton

Anonymous said...

Did not work for me, but ``sudo ln -s /usr/lib/java-1.8.0 /opt/sqldeveloper/jdk'' did the trick for me.