Friday, August 13, 2010

ORA-12705: Cannot access NLS data files or invalid environment specified

Encountered this error?
java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-12705: Cannot access NLS data files or invalid environment specified


I do not fully understand the nature of this exception and why am I getting this, but I found a simple and working solution (at least it did work for me and some others).

I encountered this error on two different occasions and below are the solutions.

1. From my unix machine, I connected to a server and executed a script which connects to a database.
SOLUTION:
On your local machine, open /etc/ssh/ssh_config for editing. You might need a sudo for that. Then comment out this line SendEnv LANG LC_*. When you connect again to the server, the script shouldn't throw this exception anymore. If it still occurs, then the problem might be in the server or application itself.

2. I was writing an application in Java which connects to a database directly.
SOLUTION:
Just add this one line before establishing the database connection :
Locale.setDefault(Locale.ENGLISH);
You might need to use another Locale depending on the locale of your database or server.

Hope it works for others too! :D

Wednesday, August 11, 2010

How to install Virtual Box on Ubuntu 10.04 LTS Lucid Lynx

This article is for those of you who wants to use Linux (in this case, Ubuntu) but for some reason, still cannot live without Windows. Just follow these simple steps :
  1. If you don't have DKMS installed, run this command on terminal :
    sudo apt-get install dkms
  2. Then you would want to make sure that you have the packages linux-headers and linux-kbuild installed. According to the VirtualBox manual, current Ubuntu releases should have the right packages installed by default.

  3. Open this file for editing : /etc/apt/sources.list

  4. Add this line to your sources.list :
    deb http://download.virtualbox.org/virtualbox/debian lucid non-free

    If you're using a different Ubuntu version (aside from Lucid Lynx), you can add any of these lines instead :

    deb http://download.virtualbox.org/virtualbox/debian karmic non-free
    deb http://download.virtualbox.org/virtualbox/debian jaunty non-free
    deb http://download.virtualbox.org/virtualbox/debian intrepid non-free
    deb http://download.virtualbox.org/virtualbox/debian hardy non-free
    deb http://download.virtualbox.org/virtualbox/debian squeeze non-free
    deb http://download.virtualbox.org/virtualbox/debian lenny non-free
    deb http://download.virtualbox.org/virtualbox/debian etch non-free


  5. Then we need to download and register the Oracle public key. You can do that by executing this command on the terminal.
    wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

  6. Then you will need to update your apt-get :
    sudo apt-get update

  7. Finally, you are now ready to install Virtual Box!
    sudo apt-get install virtualbox-3.2

  8. When the installation is done, you should now be able to access VirtualBox from : Applications > System Tools > Oracle VM VirtualBox
Hurray! :D For more info, resources are the following :
Happy virtual-boxing! ^__^