夜深了还在为关于jsp+tomcat+mysql数据库连接的问题头痛!请高手帮忙
我在tomcat容器编译时DOS中提示
java.lang.ClassNotFoundException com.mysql.jdbc.Driver
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException org.apache.jsp.first_jsp._jspService(first_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
下面是数据库的连接代码
package com.netshop;
import java.sql.*;
public class OpenDB
{
String userName= "root ";
String userPassword= "123456 ";
private String driverName = "com.mysql.jdbc.Driver ";// "org.gjt.mm.mysql.Driver ";(两种加载驱动程序方式都不行)
private String url = "jdbc:mysql://localhost/netshop?useUnicode=true&characterEncoding=gb2312 ";
Connection dbConn;
public OpenDB()
{
}
public Connection getConnection()
{
try
{
Class.forName(driverName);
dbConn=DriverManager.getConnection(url,userName,userPassword);
}
catch(Exception ex)
{
System.out.println(ex.toString());
dbConn = null;
&