你有mysql数据库的驱动吗?
如果没有去下载一个吧

解决方案 »

  1.   

    我有呢!
    com.mysql.jdbc.Driver我有的,
    我在别的地方用这一句没有错的,而且也能正常运行的
      

  2.   

    麻烦各位仁兄帮帮我呢!我的MSN:[email protected]
      

  3.   

    将你的mysql驱动复制到你的web服务器的共享lib目录去
    如:{$Tomcat}\common\lib、{$SunonAppServer}Sun\AppServer\lib、{$Weblogic}bea\weblogic81\server\lib
    或者复制到 c:\test\web-inf\lib 下,
    然后重新启动web服务器。你的“其它的程序中也是如此用的”是不是说的是命令行程序,而不是jsp程序?
    还有,你的jsp代码中没有使用<%%>包起来啊,是不是笔误?:)
      

  4.   

    我在其它的JSP中运行是成功的,而不是命令行程序!
    可以肯定的是不是语法错误,不可能是笔误!
    测试程序是:test.jsp
    <%@ page contentType="text/html; charset=gb2312"%>
    <%@ page import="java.sql.*"%>
    <%@ page import="log.*"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>测试结果</title>
    </head>
    <!--以下为HTML注释,JSP注释为《%----%>-->
    <!--若参数是从客户端获得的,那scope就为request.若是从当前获得的那就设置为page,还有session,application等-->
    <body>
    <table width="570" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr align="center"> 
        <td height="25">用户名</td>
        <td>密码</td>
        <td>账户</td>
        <td>真名</td>
      </tr>
    <%
    MysqlConnect connect=new MysqlConnect("localhost","yeahi_agent","yeahi_card","8ggq8rmo");
    String sqlStr="Select username,c_name,password,account from user";
    ResultSet rs=connect.executeSql(sqlStr);
    if(rs.next()){
    %>
      <tr align="center"> 
        <td height="25"><%=rs.getString("username")%></td>
        <td><%=rs.getString("password")%></td>
        <td><%=rs.getString("account")%></td>
        <td><%=rs.getString("c_name")%></td>
      </tr>
    <%
    }
    %>
    </table>
    </body>
    </html>