你的显示NO,可能是你没有提供MySQL登陆所需的的密码。我之前的问题是密码赋值不正确。要使用MySQL都是要提供密码的,root的密码初始为空,但是也要提供给程序。
问题应该不严重javax.servlet.ServletException: java.sql.SQLException: Access denied for user 'javatest'@'localhost' (using password: YES)
这说明是在连接数据库时出问题了。要么用户和密码不对,或者是没有权限,就是不允许从localhost连接。还可能是你没有在数据库里船舰帐号。
可以用root登录数据库后,用如下命令建立javatest帐号,用test作为密码
CREATE USER 'javatest'@'%' IDENTIFIED BY 'test'
GRANT ALL PRIVILEGES ON *.* TO 'javatest'@'%' WITH GRANT OPTION
如果这些还不行的话,那么
1。把连接数据库的Java代码贴出来
2。登录到数据库,然后 select user,host from mysql.user把结果贴出来。
3。确认把连接jdbc数据库的那个jar包放到tomcat/lib下面
改成Class.forName("com.mysql.jdbc.Driver")也不行 我的数据顺序没问题啊
错误信息:
org.apache.jasper.JasperException: Exception in JSP: /insert.jsp:53
50://out.print("添加成功!!")
51:System.out.print(sql)
52://System.out.print("11111111")
53: stm.executeUpdate(sql)
54: //System.out.print(sql)
55:System.out.print("11111111")
56:con.close()
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
javax.servlet.ServletException: Incorrect decimal value: '' for column 'opennumber' at row 1
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.insert_jsp._jspService(insert_jsp.java:117)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
java.sql.SQLException: Incorrect decimal value: '' for column 'opennumber' at row 1
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
com.mysql.jdbc.Connection.execSQL(Connection.java:3250)
com.mysql.jdbc.Statement.executeUpdate(Statement.java:1355)
com.mysql.jdbc.Statement.executeUpdate(Statement.java:1270)
org.apache.jsp.insert_jsp._jspService(insert_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)