Posted By:
Ni_zhen
Posted On:
Friday, April 11, 2003 06:05 AM
environment: 1. turbolinux,WAS 5.0,db2 8.1(with fp1) //(named "db2v8.com") 2. win2000,WSAD 5.0,db2 8.1 client(with fp1) //(named "test_env") problem: 1. run my app on WSAD 5.0 test environment with win2000(test_env),and try to get db connection remotely from the WAS 5.0 server(db2v8.com) : Hashtable env = new Hashtable() ; env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory") ; env.put(Context.PROVIDER_URL,"iiop://db2v8.com:2809"); Context ctx = new Ini
More>>
environment:
1. turbolinux,WAS 5.0,db2 8.1(with fp1) //(named
"db2v8.com")
2. win2000,WSAD 5.0,db2 8.1 client(with fp1) //(named
"test_env")
problem:
1.
run my app on WSAD 5.0 test environment with win2000(test_env),and
try to get db connection remotely from the WAS 5.0 server(db2v8.com) :
Hashtable env = new Hashtable() ;
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory")
;
env.put(Context.PROVIDER_URL,"iiop://db2v8.com:2809");
Context ctx = new InitialContext(env) ;
try{
DataSource ds = (DataSource)ctx.lookup(myDatasourceJndiName);
Connection conn = ds.getConnection(user,pwd);
}finally{
if(ctx!=null)
ctx.close();
}
and everything is OK.
2.
run my app on WAS 5.0 with turbolinux(db2v8.com),and
try to get db connection from local server(db2v8.com) :
Hashtable env = new Hashtable() ;
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory")
;
//env.put(Context.PROVIDER_URL,"iiop://db2v8.com:2809");
Context ctx = new InitialContext(env) ;
try{
DataSource ds = (DataSource)ctx.lookup(myDatasourceJndiName);
Connection conn = ds.getConnection(user,pwd);
}finally{
if(ctx!=null)
ctx.close();
}
Exception throws:
java.lang.UnsatisfiedLinkError: SQLConnect
at COM.ibm.db2.jdbc.app.DB2Connection.connect(DB2Connection.java:502)
at COM.ibm.db2.jdbc.app.DB2Connection.
(DB2Connection.java:424)
at COM.ibm.db2.jdbc.app.DB2ReusableConnection.
(DB2ReusableConnection.java:69)
at COM.ibm.db2.jdbc.DB2PooledConnection.getConnection(DB2PooledConnection.java:188)
at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getConnection(WSRdbDataSource.java:213)
at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:504)
at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1106)
at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:897)
at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1065)
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:560)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:374)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:205)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:296)
i check my WAS variables at the admin console:
DB2_JDBC_DRIVER_PATH = /home/db2inst1/sqllib/java (OK)
my jdbc provider class path = ${DB2_JDBC_DRIVER_PATH}/db2java.zip (OK)
3.
so i try to get connection directly without DataSource
on db2v8.com:
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Connection conn = DriverManager.getConnection("jdbc:db2:CBPC_V81",user,pwd);
Exception throws:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:563)
at java.sql.DriverManager.getConnection(DriverManager.java:194)
i've edited my WAS environment setup command "setupCmdLine.sh",and
put the path of db2java.zip into the variable "WAS_CLASSPATH"
anyone can help me?
THANKS!!!
<<Less