当前位置: 技术问答>java相关
关于JSP链接Sybase数据库的问题,请各位指教
来源: 互联网 发布时间:2015-11-16
本文导语: 我写了一个CONN.JSP页放到TOMCAT中,在这其中我链接数据库,以下是我这一页的出错信息以及CONN页的源代码,以前这个页是可正常链接的,自从我从装了我的机器以后,就不行了,请大家给我看看,具体错在什么地方,我想应是我...
我写了一个CONN.JSP页放到TOMCAT中,在这其中我链接数据库,以下是我这一页的出错信息以及CONN页的源代码,以前这个页是可正常链接的,自从我从装了我的机器以后,就不行了,请大家给我看看,具体错在什么地方,我想应是我环境没有配好
Error: 500
Location: /jsptest/conn.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
D:TOMCATworklocalhost_8080%2Fjsptest_0002fconn_0002ejspconn_jsp_9.java:67: Ambiguous class: java.beans.Statement and java.sql.Statement
Statement stmtent=null;
^
1 error, 1 warning
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:536)
数据库链接测试
代码
Error: 500
Location: /jsptest/conn.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
D:TOMCATworklocalhost_8080%2Fjsptest_0002fconn_0002ejspconn_jsp_9.java:67: Ambiguous class: java.beans.Statement and java.sql.Statement
Statement stmtent=null;
^
1 error, 1 warning
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:536)
数据库链接测试
代码
|
java.beans.Statement and java.sql.Statement
这两个地方都有Statement
系统不知道你该声明哪一个
应该
java.sql.Statement stmtent=null;
建议
声明类的时候不要同名
这两个地方都有Statement
系统不知道你该声明哪一个
应该
java.sql.Statement stmtent=null;
建议
声明类的时候不要同名
|
在java.beans和java.sql包中都有Statement类,在声明Statement 的地方用java.sql.Statement stmt