ORA-00604 ORA-12705
Asked Answered
M

11

12

I am having this error in my j2ee web application.

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

 oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
 oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
 oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
 oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
 oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:785)
 oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:376)
 oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)
 oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
 oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
 oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:839)
 java.sql.DriverManager.getConnection(Unknown Source)
 java.sql.DriverManager.getConnection(Unknown Source)
 org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
 org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
 org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
 org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
 org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
 org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)


 org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
 org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)

This project works in my colleagues' PCs... I mean this project works for them but when I asked for their project folder and imported it on my eclipse, when i run it i meet this error. The jar files are already packaged with the project folder.

I also created a simple j2ee project using hibernate but I had the same error. I tried to ping the DB server and browse it using PL/SQL developer and I don't have any problem with it

Mint answered 27/10, 2009 at 7:59 Comment(0)
B
8

Try following:

  1. Check that NLS_LANG setting is correct. On windows it is in registry under \HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE.
  2. Check that Oracle client software is correctly installed.
  3. Check if there are multiple Oracle homes on that computer. In that case, find active one and check if it works.
  4. Test with SQL*Plus if there is one installed. Sql Developer works because it has its own client installation.

Edit:
Regarding drivers, check this site: Oracle Instant Client. There you will find documentation on minimum drivers installation needed for JDBC access to Oracle. I don't know much about that because I use .Net.

Edit 2:
See this question: NLS_LANG setting for JDBC thin driver. There is same error as you have and problem was that default locale for NLS LANG was not defined. Quote:

The NLS_LANG settings are derived from the java.util.Locale . Therefore, you will need to make a call similar to this before connecting:

  Locale.setDefault(Locale.<your locale here>);
Brian answered 27/10, 2009 at 11:12 Comment(1)
Do I have to install an oracle client for my web app to connect? I thought I just need the odbc driver jar included in my project.Mint
A
8

I figured out that that you could pass that two params to your Java app to resolve the issue:

-Duser.country=en -Duser.language=en

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

Albigenses answered 8/4, 2010 at 12:56 Comment(0)
S
7

I had the same problem. The solution was to add the country and the language to sqldeveloper.conf

Please open the file:

\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf

And add the following:

AddVMOption -Duser.language=en
AddVMOption -Duser.region=us

The above does the trick.

Reference: http://forum.oradba.net/showthread.php?t=423&langid=1

Squid answered 12/12, 2011 at 12:13 Comment(3)
Worked for me. But that is rocket science... I mean how would I guess it...Digestive
You're the governor lol, 2 hours later thank you so much!Ubiety
You saved my day.Fitted
S
5

For Windows env, you need to change the System Locale and System Format to English/US.

How to change system locale?

Sergu answered 28/11, 2012 at 6:44 Comment(0)
O
1

I found solution, I just change the regional and language in my OS (windows 7), make sure it matches with the oracle regional and language.

Overskirt answered 3/8, 2010 at 7:43 Comment(0)
C
1

Oracle JDBC driver implicitly executes following statement after opening new connection:

ALTER SESSION SET NLS_LANGUAGE='language' NLS_TERRITORY='territory'

In our case we had problems with Oracle XE 11g and default language/territory mappings embedded into JDBC driver: 'ru' locale was mapped to 'CIS' territory which is supported only by Oracle EE, but Oracle XE had 'RUSSIA' territory only. Here is the way we fixed this:

-Doracle.jdbc.territoryMap="ru=RUSSIA;RU=RUSSIA"

There is option for NLS_LANGUAGE(we had no problems with defaults):

-Doracle.jdbc.languageMap="ru=RUSSIAN;RU=RUSSIAN"

Fixed: constant ru=RUSSIAN taken from class oracle.sql.converter.CharacterSetMetaData of java jdbc driver.

Cambell answered 27/2, 2016 at 18:47 Comment(1)
Thank you for this answer! In my case it was System.setProperty("oracle.jdbc.territoryMap", "ru=RUSSIA;RU=CIS"); assignment that solved the problem (for the old Oracle9i).Inaccuracy
D
1

If you are compiling with intelljIDE I advise you add following options in VMoptions found in configurations model

AddVMOption -Duser.region=us. 
Diffraction answered 25/10, 2019 at 15:47 Comment(0)
B
0

First execute query:

select userenv('LANGUAGE') from dual;`

This will give oracle regional and language. Change the regional and language in OS, both should match.

Bedaub answered 27/3, 2018 at 7:6 Comment(0)
A
0

check the JAVA_HOME system variable and verify that it is the same version you are using in your projects and programs

Anthropomorphous answered 27/2, 2019 at 20:19 Comment(1)
you should provide more info about this variable: where to find it? what does it really do? etc.Yorkist
K
0

Changing the region settings and language of my machine helped to get away with this. I changed region to United States and English (United States) as language.

Kwapong answered 25/11, 2019 at 7:6 Comment(0)
M
0

If you are running a spring application just add Locale.setDefault(Locale.ENGLISH); at main class.

public static void main(String[] args) throws Exception
{
    Locale.setDefault(Locale.ENGLISH);
    SpringApplication.run(ApplicationName.class, args);



}
Marou answered 30/4, 2021 at 10:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.