By Franck Pachot

.
I’m using Oracle SQL Developer 4.1 Early Adopter for a while and I like it. That version comes with a command line (in beta) which goal is to be fully compatible with sqlplus but running in java, and having a lot more features.

Becuse it’s connecting with thin java driver by default, it doesn’t use NLS_LANG. It’s java. It’s unicode. So here is how to set the language and characterset with the java options.

-Duser.language

By default java uses the language that is set by your operating system locale. You can change it with the user.language option. For SQL Developer you put it on the command line as ‘-Duser.language=en’ and for the command line you can set it in the DEBUG environment variable (this is for the alpha version – may change in the future).

Here is an example:

b2ap3_thumbnail_CaptureSQLCL1.JPG

I had the date in French and because it’s unicode it displays bad characters on my DOS window. I changed it to English.
You probably already know that. When you have a non-english locale and want to have SQL Developer in inglish, you just run:

sqldeveloper.exe -Duser.language=en

-Dfile.encoding

What if I want to keep my local and display the special characters correctly?
My DOS window is in PC850 characterset (I’ve blogged about that recently). Here is how to set the characterset in Java:

b2ap3_thumbnail_CaptureSQLCL2.JPG

So, when you will port your sqlplus scripts to the new SQL Developer command line, don’t forget to check the NLS_LANG you were using and set the right Java environement.

And the territory

NLS_LANG sets characterse, language and territory. Currently I don’t think we can set the territory from the command line environment. But login.sql is still used as in sqlplus, so we can put all ALTER SESSION SET NLS_… in it.