日期:2014-05-17  浏览次数:20701 次

jsp链接mysql数据库,报错:java.sql.SQLException: No suitable driver found for jdbc
我这个项目运行很久了,今天突然报错说找不到驱动
而且错误都是出现在JSP页面上,我同一个项目下的java程序链接数据库都没问题,请

问这是什么原因?

我试过重新下载一个驱动,还是同样结果,java程序运行没问题,JSP就报错
以下是JSP页面代码,求助求助!
HTML code

<%@ page language="java"%>
<%@ page import="java.sql.*"%> 
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<HTML>
    <HEAD>
        <TITLE>FusionCharts Free - Database And Connection Class 

Example</TITLE>
        <SCRIPT LANGUAGE="Javascript" 

SRC="FusionCharts/FusionCharts.js"></SCRIPT>
        <style type="text/css">
            <!--
            body {
                font-family: Arial, Helvetica, sans-serif;
                font-size: 12px;
            }
            .text{
                font-family: Arial, Helvetica, sans-serif;
                font-size: 12px;
            }
            -->
            </style>
    </HEAD>
    <BODY>
        <CENTER>
            <h2><a href="http://www.fusioncharts.com" 

target="_blank">FusionCharts Free</a> Database and Connection Class 

Example</h2>
            <%
                Connection con = DriverManager.getConnection

("jdbc:mysql://127.0.0.1:3306/rv_mining","root","123123");
                Statement st1=null,st2=null;
                ResultSet rs1=null,rs2=null;
                //strXML will be used to store the entire 

XML document generated
                String strXML="";
    
                //Generate the chart element
                strXML = "<graph caption='Factory Output 

report' subCaption='By Quantity' decimalPrecision='0' showNames='1'  

numberSuffix=' Units'  pieSliceDepth='30' formatNumberScale='0'>";
            
                try {        
                    st1=con.createStatement();
                    rs1=st1.executeQuery("select 

phone_id from rvm_phoneinfo");
                
                    int pid = 0;
                    //Iterate through each factory        
                    while(rs1.next()) {
                        pid=rs1.getInt("phone_id");
                        //Now create second 

recordset to get details for this factory
                        //Construct the query to 

retrieve data
                        int P = 0;
                        //int N = 0;
                        String tid = null;
                        st2=con.createStatement();
                        rs2 = st2.executeQuery

("select * from rvm_chart where phone_id="+pid+"");
                        while(rs2.next()){
                            tid=rs2.getString

("para_id");
                            P = rs2.getInt

("P_value");
                            //N = rs2.getInt

("N_value");
                            strXML += "<set 

name='" + tid + "' value=" +P+ "/>";
                        }
                        rs2.close();
                        st2.close();
                    } //end of while
                    rs1.close();
                    st1.close();
                    con.close();
                }catch(SQLException e) {
                    e.printStackTrace();
                }
                //Finally, close <graph> element
                strXML += "</graph>";
                //close the resulset,statement,connection
                //Create the chart - Pie 3D Chart with data 

from strXM