java - Jboss Oracle JDBC 连接失败

标签 java oracle jdbc jboss oracle11g

Jboss EAP 6.3,Oracle 11g Express。 我有这个独立的 oracle 数据源:

                <datasource jta="true" jndi-name="java:/OracleDS" pool-name="OracleDS">
                <connection-url>jdbc:oracle:thin:@localhost:1521:XE</connection-url>
                <driver>oracleDriver</driver>
                <security>
                    <user-name>Boris</user-name>
                    <password>password</password>
                </security>
            </datasource>
            <drivers>
                <driver name="oracleDriver" module="com.oracle">
                    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                </driver>
            </drivers>

Oracle 数据库正在运行,我可以使用 sqlplus 连接到它:

SQL> connect
Enter user-name: Boris
Enter password: 
Connected.

数据源显示在 Jboss 管理面板中。我运行了一个测试连接,但它的响应是:

Unexpected HTTP response: 500

Request
{
    "address" => [
        ("subsystem" => "datasources"),
        ("data-source" => "OracleDS")
    ],
    "operation" => "test-connection-in-pool"
}

Response

Internal Server Error
{
    "outcome" => "failed",
    "failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",
    "rolled-back" => true
}

在 jboss 控制台中我发现了这个:

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

但我在互联网上找到的该错误的解决方案并没有帮助。

我做错了什么?

最佳答案

ORA-12705 错误表明这可能是区域设置问题。您可以尝试使用 supported by Oracle XE 的语言环境启动 JBoss转换为 NLS 时。例如,尝试将此添加到您的 JBoss 启动配置(jboss-as/bin/run.conf 中的JAVA_OPTS 变量):

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

关于java - Jboss Oracle JDBC 连接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29566014/

相关文章:

java - 如何让 Java 线程通知自己?

java.lang.ClassNotFoundException : org. mariadb.jdbc.Driver

oracle - Oracle DDL/DML脚本,源代码管理中的PL/SQL

oracle - 使用 PLSQL 获取 LDAP 用户列表

java - 使用 BasicDataSource 通过 SSL 安全连接到 mysql

java - 使用JDBC和MySQL解决“通信链接失败”问题

java - 如何将 UTC 日期时间转换并格式化为本地时间

java - 在 JSP 中使用 for 循环

sql - 正确的查询设计?交叉连接驱动临时报告界面

java - 特殊字符和 preparedStatement 的问题,仅当我使用 setString 时