Open Connection via DataSource in WSAD
843854Dec 19 2002 — edited Jan 28 2003Hi there,
I am using DataSource to get a connection to db.
Enviornment:
WSAD 5;
WebSphere 4.0.3;
DB2 v7.2 (fix 3)
I got an error
%%%%%%%%%%%%%%%%%%%%%%%%
com.ibm.ejs.jts.jts.CurrentSet$InitializationError: not initialized
at com.ibm.ejs.jts.jts.CurrentSet.self(CurrentSet.java:218)
at com.ibm.ejs.jts.jts.CurrentSet.get_control(CurrentSet.java:265)
at com.ibm.ejs.jts.jts.Current.get_control(Current.java:72)
at com.ibm.ejs.util.tran.Util.getCoordinator(Util.java:13)
at com.ibm.ejs.cm.pool.ConnectionPool.allocateConnection(ConnectionPool.java:649)
at com.ibm.ejs.cm.pool.ConnectionPool.getConnection(ConnectionPool.java:297)
at com.ibm.ejs.cm.DataSourceImpl$1.run(DataSourceImpl.java:129)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:127)
%%%%%%%%%%%%%%
the source code is
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://127.0.0.1:900");
InitialContext ctx = new InitialContext(env);
DataSource ds = (DataSource) ctx.lookup(jndi);
Connection conn = ds.getConnection(userID, password);
} catch (Exception ex) {
ex.printStackTrace();
}
I would appreciate your help
Simon