加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

oracle – ORA-12705:无法访问NLS数据文件或指定的无效环境

发布时间:2020-12-12 13:04:30 所属栏目:百科 来源:网络整理
导读:我在尝试在Oracle数据库Oracle 10gR2上创建连接池时收到此错误. java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1ORA-12705: Cannot access NLS data files or invalid environment specified 我可以通过sqlplus amp; iSQLPlus客
我在尝试在Oracle数据库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

我可以通过sqlplus& amp; iSQLPlus客户端,但是当我尝试使用这个Java程序进行连接时,我只是在初始化连接池并且没有初始化连接池时才会收到此错误.

有人可以帮我解决一下吗?

数据库版本:Oracle 10.2.0.1版

操作系统:RHEL 4.0

这是一个准系统,java代码在连接到我的数据库时抛出此错误.

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";

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

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

            System.out.println("Success!");

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

}
我发现你可以将这两个参数传递给你的Java应用程序来解决这个问题:
-Duser.country=en -Duser.language=en

您也可以在环境变量级别配置值(取决于您的操作系统).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读