熟悉resin的网友进来看一下!
我用datasource连接数据库,连接成功了,但是查不到记录
jsp:
Context dbEnv = (Context) new InitialContext().lookup("java:comp/env") ;
DataSource dbDs = (DataSource)dbEnv.lookup("jdbc/test") ;
Connection dbCon = dbDs.getConnection() ;
tatement dbStm = dbCon.createStatement();
String strSQL = "select * from Territories";
ResultSet rs = dbStm.executeQuery(strSQL);
if(!rs.next());
out.println("null");
resin配制:
<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.ConnectionPoolDataSource</res-type>
<init-param driver-name="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<init-param url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Northwind"/>
<init-param user="sa"/>
<init-param password="sa"/>
<init-param max-connections="20"/>
<init-param max-idle-time="30"/>
</resource-ref>
运行结果总是打印null,这是为何???