S
sdcx
Unregistered / Unconfirmed
GUEST, unregistred user!
我用的mssql jdbc,我在classpath里设置了,又把3个jar文件copy到resin的Lib下了,
还是不行,提示
500 Servlet Exception
java.lang.NullPointerException
at _test__jsp._jspService(/test.jsp:18)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:497)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:344)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:536)
源代码:
<%@ page import="java.sql.*" %>
<%@ page import="com.caucho.*" %>
<%! Connection con=null;
ResultSet rs=null;
Statement stmt=null;
String drver="com.microsoft.jdbc.sqlserver.SQLServerDriver";%>
<% try{
Class.forName(drver);
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.100.201:1433;DatabaseName=book");
rs=stmt.executeQuery("select * from dc");
while(rs.next()){ %>
<%=rs.getString("word")%>
<% } }//end try
catch(ClassNotFoundException e){
out.print("class err");
}
catch(SQLException e){
out.print("sql err");
}
rs.close();
stmt.close();
con.close();
%>
还是不行,提示
500 Servlet Exception
java.lang.NullPointerException
at _test__jsp._jspService(/test.jsp:18)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:497)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:344)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:536)
源代码:
<%@ page import="java.sql.*" %>
<%@ page import="com.caucho.*" %>
<%! Connection con=null;
ResultSet rs=null;
Statement stmt=null;
String drver="com.microsoft.jdbc.sqlserver.SQLServerDriver";%>
<% try{
Class.forName(drver);
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.100.201:1433;DatabaseName=book");
rs=stmt.executeQuery("select * from dc");
while(rs.next()){ %>
<%=rs.getString("word")%>
<% } }//end try
catch(ClassNotFoundException e){
out.print("class err");
}
catch(SQLException e){
out.print("sql err");
}
rs.close();
stmt.close();
con.close();
%>