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

No comments:

Post a Comment