I have a Rational Java EE project that I’m building. I deploy the package to WebSphere 9 on Linux systems. Everything works correctly if I use oracle.jdbc.driver.OracleDriver, ojdbc8.jar, and connect with DriverManager and a connection string.

I have setup a DataSource in Websphere and it connects correctly.

When I have my project try to connect with the data source I get the following error:

java.lang.ClassCastException: GCWrapper.view._GCWrapperSOAPInterfaceRemote_Stub incompatible with javax.sql.DataSource

Any help would be much appreciated.

code snippet:

private static Connection getConnection()
{       
    Connection conn = null;     
    Context initContext = null;
    try {           

        if(_isLocal.Value()){

            String url = "jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = scanora2017.xxxx.com)(PORT = 2015)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dkpgcs.xxxx.com)))";
            String user = "wrapper";
            String password = "xxxxx";
            Driver sqlDriver = new oracle.jdbc.driver.OracleDriver();
            DriverManager.registerDriver(sqlDriver);
            conn = DriverManager.getConnection(url, user, password);
        }
        else {              
            initContext = new InitialContext();             
            DataSource ds = (DataSource) initContext.lookup("jdbc/WRAPPERDATASOURCE");
            conn = ds.getConnection();
        }
    } catch (Exception e) {

        System.out.println(e.getMessage());
        e.printStackTrace();            
    }       
    return conn;
}

WebSphere Data Source: Data Source

JDBC Provider: JDBC Provider

0

There are 0 answers