weblogic8中配置连接池成功了,但是lookup不到?
我用的是mysql.
我的连接池jndi name是jdbc/mysql,Datasource和connection pool都测试成功了,但一用jdbc/mysql就报错:"javax.naming.NameNotFoundException: While trying to lookup 'jdbc.mysql' didn't find subcontext 'jdbc' Resolved ; remaining name 'jdbc/mysql' "
即使用了java:comp/env/jdbc/mysql或直接用mysql都包类似这个错误,谁遇到过?
//////////////////////test.jsp/////////////////////////////////
String sql="select * from guestbook";
try{
Context ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup("jdbc/mysql");
Connection conn=ds.getConnection();
Statement stm=conn.createStatement();
ResultSet rs=stm.executeQuery(sql);
while(rs.next()){
out.println(rs.getString("id"));
out.println(rs.getString("title"));
out.println(rs.getString("name"));
}
}catch(Exception e){
out.println(e.toString());
}