就是这样:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory"); try {
Context ctx = new InitialContext(env); ConnectionPool pool=new ConnectionPool(driver,url,user,psw, initialConnections, maxConnections,true);
ctx.bind(filePath, pool) ;
ctx.close() ;
} catch (Exception ex) {
System.err.println("ERROR: " + ex.getMessage()) ;
}
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory"); try {
Context ctx = new InitialContext(env); ConnectionPool pool=new ConnectionPool(driver,url,user,psw, initialConnections, maxConnections,true);
ctx.bind(filePath, pool) ;
ctx.close() ;
} catch (Exception ex) {
System.err.println("ERROR: " + ex.getMessage()) ;
}
如果邦定引用,必须实现 Referenceable