String tDriver = "org.gjt.mm.mysql.Driver";
String tUrl = "jdbc:mysql://localhost:3306/javatest";
String tUser = "root";
String tPassWord = "";
conn = db.getConn(tDriver, tUrl, tUser, tPassWord);
就是这句,如果我用这个root没有密码的用户,连接数据库正常,
但是如果我改成有密码的用户,连接就会出错,
String tDriver = "org.gjt.mm.mysql.Driver";
String tUrl = "jdbc:mysql://localhost:3306/javatest";
String tUser = "admin";
String tPassWord = "admin";
conn = db.getConn(tDriver, tUrl, tUser, tPassWord);
上面这样就不行了,
admin是有这个用户的,而且密码也是正确的,权限也不会有问题的
这到底是怎么回事啊?
有哪位高手可以告诉我啊?
谢谢先了!!!
下面是出错的代码
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
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:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
root cause
java.lang.NullPointerException
database.DbConn.execute(DbConn.java:49)
dao.Guestbook.insert(Guestbook.java:128)
org.apache.jsp.guestbook_jsp._jspService(guestbook_jsp.java:60)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.9