日期:2014-05-18  浏览次数:20712 次

sql+tomcat的问题,十多天解决不了,救命啊
源程序
<%@   page   contentType= "text/html;charset=GB2312 "   %>
<%@   page   import= "java.sql.* "   %>
<html>
<body>
<%
  Connection   con;
  Statement   sql;
  ResultSet   rs;
        out.print( "a ");
        con=DriverManager.getConnection( "jdbc:odbc:yuan ", "sa ", " ");
            out.print( "b ");
        sql=con.createStatement();
        rs=sql.executeQuery( "SELECT   *   FROM   login ");
        while(rs.next())
{
        out.print(rs.getString( "name "));
        out.print(rs.getString( "password "));
}
con.close();
%>    
</body>
</html>    
错误
exception  

org.apache.jasper.JasperException:   An   exception   occurred   processing   JSP   page   /tt.jsp   at   line   10

7:     Statement   sql;
8:     ResultSet   rs;
9:           out.print( "a ");
10:           con=DriverManager.getConnection( "jdbc:odbc:yuan ", "sa ", " ");
11:               out.print( "b ");
12:           sql=con.createStatement();
13:           rs=sql.executeQuery( "SELECT   *   FROM   login ");


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root   cause  

javax.servlet.ServletException:   java.sql.SQLException:   No   suitable   driver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.tt_jsp._jspService(tt_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root   cause  

java.sql.SQLException:   No   suitable   driver
java.sql.DriverManager.getConnection(Driv