ORA-00604 ORA-12705
我的 j2ee Web 应用程序中出现此错误。
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)
这个项目在我同事的电脑上工作...我的意思是这个项目适用于他们,但是当我询问他们的项目文件夹并将其导入到我的 eclipse 上时,当我运行它时,我遇到了这个错误。 jar 文件已经打包到项目文件夹中。
我还使用 hibernate 创建了一个简单的 j2ee 项目,但我遇到了同样的错误。 我尝试 ping 数据库服务器并使用 PL/SQL Developer 浏览它,但没有任何问题
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
请尝试以下操作:
\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
下的注册表中。编辑:
关于驱动程序,请检查此站点:Oracle Instant Client。在那里您将找到有关 JDBC 访问 Oracle 所需的最低驱动程序安装的文档。我对此不太了解,因为我使用.Net。
编辑2:
请参阅此问题:JDBC 瘦驱动程序的 NLS_LANG 设置。存在与您相同的错误,问题是未定义 NLS LANG 的默认区域设置。引用:
Try following:
\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
.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:
我发现您可以将这两个参数传递给 Java 应用程序来解决问题:
您也可以在环境变量级别配置值(取决于您的操作系统)。
I figured out that that you could pass that two params to your Java app to resolve the issue:
You could configure the values at environment variable level as well (depends from your OS).
我也有同样的问题。解决方案是将国家/地区和语言添加到
sqldeveloper.conf
请打开文件:
并添加以下内容:
上面的方法可以解决问题。
参考:http://forum.oradba.net/showthread.php?t =423&langid=1
I had the same problem. The solution was to add the country and the language to
sqldeveloper.conf
Please open the file:
And add the following:
The above does the trick.
Reference: http://forum.oradba.net/showthread.php?t=423&langid=1
对于 Windows 环境,您需要将系统区域设置和
系统格式
更改为英语/美国
。如何更改系统区域设置?
For Windows env, you need to change the System Locale and
System Format
toEnglish/US
.How to change system locale?
我找到了解决方案,我只需更改操作系统(Windows 7)中的区域和语言,确保它与 Oracle 区域和语言匹配。
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.
Oracle JDBC 驱动程序在打开新连接后隐式执行以下语句:
在我们的例子中,我们遇到了 Oracle XE 11g 和嵌入到 JDBC 驱动程序中的默认语言/区域映射的问题:“ru”区域设置被映射到仅由 Oracle 支持的“CIS”区域EE,但 Oracle XE 仅具有“俄罗斯”领土。
以下是我们修复此问题的方法:
有 NLS_LANGUAGE 选项(默认设置没有问题):
修复:从 java jdbc 驱动程序的 oracle.sql.converter.CharacterSetMetaData 类获取的常量 ru=RUSSIAN。
Oracle JDBC driver implicitly executes following statement after opening new connection:
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:
There is option for NLS_LANGUAGE(we had no problems with defaults):
Fixed: constant ru=RUSSIAN taken from class oracle.sql.converter.CharacterSetMetaData of java jdbc driver.
如果您使用 intelljIDE 进行编译,我建议您在配置模型中找到的 VMoptions 中添加以下选项
If you are compiling with intelljIDE I advise you add following options in VMoptions found in configurations model
首先执行查询:
这将给出oracle区域和语言。更改操作系统中的区域和语言,两者应该匹配。
First execute query:
This will give oracle regional and language. Change the regional and language in OS, both should match.
检查 JAVA_HOME 系统变量并验证它是否与您在项目和程序中使用的版本相同
check the JAVA_HOME system variable and verify that it is the same version you are using in your projects and programs
更改我的机器的区域设置和语言有助于解决这个问题。
我将区域更改为美国,并将英语(美国)更改为语言。
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.
如果您正在运行 Spring 应用程序,只需添加 Locale.setDefault(Locale.ENGLISH);在主课上。
If you are running a spring application just add Locale.setDefault(Locale.ENGLISH); at main class.