可以的在servlet中写个函数
使用lookup JNDI的方法得到配置的datasource从而可以进行JDBC操作Hashtable parms = new Hashtable();
DataSource ds = null;
parms.put(Context.INITIAL_CONTEXT_FACTORY, jndiFactory);//jndiFactory因容器而异
Context ctx = new InitialContext(parms);
ds = (DataSource) ctx.lookup(dsjndi);//JNDI名字
使用lookup JNDI的方法得到配置的datasource从而可以进行JDBC操作Hashtable parms = new Hashtable();
DataSource ds = null;
parms.put(Context.INITIAL_CONTEXT_FACTORY, jndiFactory);//jndiFactory因容器而异
Context ctx = new InitialContext(parms);
ds = (DataSource) ctx.lookup(dsjndi);//JNDI名字
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货