无法获得Oracle连接 [英] Unable to get an Oracle connection

查看:107
本文介绍了无法获得Oracle连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法建立Oracle连接.

Unable to get an Oracle connection.

我正在使用以下代码,以便在自定义智能服务插件中获得oracle连接:-

I am using the following piece of code in order to get an oracle connection in a custom smart service plugin :-

public static Connection openNewConnection(String url, String username, String password) throws ClassNotFoundException, SQLException {

    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    Connection connection = DriverManager.getConnection(url, username, password);
    return connection;
}

它可以很好地作为独立运行,但是在JBoss中使用时,它会为"ClassCastExcepton"提供以下消息:-

It works perfectly fine as a standalone, but when used inside JBoss, it gives "ClassCastExcepton" with the following message :-

ClassCastException:"oracle.jdbc.driver.T4CConnection无法强制转换 到oracle.jdbc.OracleConnection".

ClassCastException : "oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection".

我已经分别将此文件用于ojdbc5.jarojdbc6.jarojdbc7.jarojdbc14.jar文件.

I have used this with ojdbc5.jar, ojdbc6.jar, ojdbc7.jar and ojdbc14.jar files respectively.

有关此问题的任何线索吗?

Any clues to this issue ?

推荐答案

在此

According to "Display Name is missing's" answer on this Error casting T4CConnection to OracleConnection , ojdbcN.jar causes a conflict that you have to resolve by re-referencing correctly.

这篇关于无法获得Oracle连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆