Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am getting this error while trying to create a connection pool, on my Oracle database, Oracle 10gR2.

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

I am able to connect to the database over sqlplus & iSQLPlus client, but when I try to connect using this Java program, I get this error just when the connection pool is to be initialised and it does not initialise the connection pool.

Can someone please help me resolving it?

DB Version: Oracle version

OS: RHEL 4.0

Here is a barebone, java code which is throwing this error, while connecting to my database.

import java.sql.*;

public class connect{
    public static void main(String[] args) {
    	Connection con = null;
    	CallableStatement cstmt = null;

    	String url = "jdbc:oracle:thin:@hostname:1521:oracle";
    	String userName = "username";
    	String password = "password";

    		System.out.println("Registering Driver ...");
    		DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

    		System.out.println("Creating Connection ...");
    		con = DriverManager.getConnection(url, userName, password);


    	} catch(Exception ex) {
    	  } finally {
    		if(cstmt != null) try{cstmt.close();}catch(Exception _ex){}
    		if(con != null) try{con.close();}catch(Exception _ex){}

share|improve this question

I figured out that that you could pass that two params to your Java app to resolve the issue: -Duser.language=en

You could configure the values at environment variable level as well (depends from your OS).

share|improve this answer
That works without changing Java sources. Thanks! – Michał Niklas Nov 19 '10 at 11:53
I was getting the same error in SQLDeveloper. Adding AddVMOption -Duser.language=en AddVMOption -Duser.region=us to sqldeveloper\sqldeveloper\bin\sqldeveloper.conf helps. (Posting this as comment because can't answer this protected question.) – Vadzim Jun 15 '15 at 13:08

import java.util.*;

Locale.setDefault(Locale.ENGLISH); // use this for change NLS
   String URL = "jdbc:oracle:thin:@//"+khost+":"+kport+"/"+kbasename;

DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
   Connection con = DriverManager.getConnection(URL,kuser,kpassword);
share|improve this answer

What is


set to on the machine where you are trying to execute the java program from? If you haven't already, you should first unset NLS_LANG and try that. If that doesn't work, set it to the character set of your specific database and see if that fixes the issue.

share|improve this answer

Document #158654.1 in Metalink explains how to resolve this kind of errors.

It could be a simple error in your environnement (have a look at the $NLS_* environnement variables) or a rights permissions (Do you have rights on $ORACLE_HOME/ocommon/nls/admin/data ?)

share|improve this answer
Trying to connect with oracle user only, with permissions. – M.N Sep 11 '09 at 6:09
Maybee a script or a tool you used set the NLS_* variable to a wrong value. What does "env | grep NLS" says? The right could have been changed by doing a wrong manipulation. What does "ls -l $ORACLE_HOME/ocommon/nls/admin/data" says? – Benoit Sep 11 '09 at 8:55
where to look for the $ORACLE_HOME/ocommon/nls/admin/data directory. on the client system if the application is a j2ee based or on the database server. – Viky Oct 5 '09 at 13:25

protected by splattne Dec 29 '10 at 13:55

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.