2014-02-25 129 views
0

我已经完成了在新环境中设置MySql所需的一切,我总是成功地将它转移到另一台PC。但现在有一个错误,该错误表示:通过JSP连接到MySql时出错

HTTP Status 500 - An exception occurred processing JSP page /include/database.jsp at line 4 

-------------------------------------------------------------------------------- 

type Exception report 

message An exception occurred processing JSP page /include/database.jsp at line 4 

description The server encountered an internal error that prevented it from fulfilling this request. 

exception 
    org.apache.jasper.JasperException: An exception occurred processing JSP page /include/database.jsp at line 4 

    1: <%@ page import="java.sql.*;" %> 
    2: 
    3: <% 
    4: Connection con=DriverManager.getConnection("jdbc:mysql://localhost/bms", "root",""); 
    5: 
    6: Statement stmt=con.createStatement(); 
    7: Statement stmt1=con.createStatement(); 

    This is the whole code: 
     <%@ page import="java.sql.*;" %> 

     <% 
     Class.forName("com.mysql.jdbc.Driver"); 
     Connection con=DriverManager.getConnection("jdbc:mysql://localhost/bms", "root",""); 

     Statement stmt=con.createStatement(); 
     Statement stmt1=con.createStatement(); 
     Statement stmt2=con.createStatement(); 
     Statement stmt3=con.createStatement(); 
     Statement stmt4=con.createStatement(); 
     Statement stmt5=con.createStatement(); 

     ResultSet rs,rs1,rs2,rs3,rs4,rs5; 

     PreparedStatement pstmt,pstmt1,pstmt2,pstmt3,pstmt4,pstmt5; 

     %> 
+0

你有更多的堆栈跟踪共享? –

+1

请学习使用servlet。 :-) –

+0

删除;从进口 – Leo

回答

0

您需要到MySQL连接器jar添加到类路径的Web应用程序,所以可能只是罐子复制到WEB-INF/lib文件夹。

我试着重新创建一些页面,并为缺少的jar获得了500个 - 之后 - 连接可用,但是我没有真正运行语句,因为你的问题从来没有那么远。