Unable to get an Oracle connection.
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;
}
It works perfectly fine as a standalone, but when used inside JBoss, it gives "ClassCastExcepton"
with the following message :-
ClassCastException : "oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection".
I have used this with ojdbc5.jar
, ojdbc6.jar
, ojdbc7.jar
and ojdbc14.jar
files respectively.
Any clues to this issue ?