我用Tomcat5.5 数据库为SQL2000,我已经打过补丁,但就是连接不上,各位高手帮帮我。
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause java.lang.NullPointerException
org.apache.jsp.db_jsp._jspService(db_jsp.java:71)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause java.lang.NullPointerException
org.apache.jsp.db_jsp._jspService(db_jsp.java:71)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
<body> <%
String dbDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver";
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:sqlserver://localhost:1433;databaseName=ticketorder";
String user="sa";
String password="123";
Connection Conn=null;
ResultSet rs=null;
Statement stmt=null;
try{
Class.forName(dbDriver);
Conn=DriverManager.getConnection(url,user,password);
stmt=Conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from admin"; rs=stmt.executeQuery(sql);
}
catch(Exception ex){
System.out.println(ex+"Error");
}
while(rs.next()) {
%>
test<br><%}%>
<%out.print("数据库操作成功");%> <br>
<%rs.close();
stmt.close();
Conn.close();
%>
</body>
String dbURL = "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=sample";而SQL Server 2005 中加载驱动和url的语句则为String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=sample";可以看出版本不同连接方法也是不同的。SQL Server有许多不同版本,看你用的是哪个了。 ===========================================================================
String dbDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver";
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
你这开始的两行就矛盾了。
Class.forName(dbDriver);怎么写了两个
补丁sp3
不用hibernate都可以用