关于JSP连接池出错请教大家!
我的JSP采用连接池,在调用连接池时候出现错误,如下错误:javax.servlet.ServletException: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
下面是我的连接接代码:
import java.sql.*;
import javax.naming.*;
import javax.sql.DatabaseSource;
public class DBConn{
public static sychronized Connection getConnection()throws Exception{
try{
Connection cn=new InitialConnection();
Connection dn=(Connection)cn.lookup("java:comp/env");
DatabaseSource ds=(DatabaseSource)dn.lookup("jdbc/db_shop");
return ds.getConnection();
}
catch(NamingException e){
throws e;
}
catch(SQLException e){
throws e;
}
}
}
上面的错误是我在应用在我的JSP网站的时候页面给我提示的错误!!请大家帮我看看,谢谢了!!