当前位置: 技术问答>java相关
怎么我老是连接不上数据库啊!急!
来源: 互联网 发布时间:2015-06-12
本文导语: 源文件: DateBase Test 运行结果: Error: 500 Location: /db.jsp Internal Servlet Error: javax.servlet.ServletException: [Microsoft][ODBC ???? ???] ??????? at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:455) at db_...
源文件:
DateBase Test
运行结果:
Error: 500
Location: /db.jsp
Internal Servlet Error:
javax.servlet.ServletException: [Microsoft][ODBC ???? ???] ???????
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:455)
at db_1._jspService(db_1.java:90)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:500)
at org.apache.tomcat.core.Handler.service(Handler.java:223)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:448)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:911)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:824)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:152)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:438)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:505)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.sql.SQLException: [Microsoft][ODBC ???? ???] ???????
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3266)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5377)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:320)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:376)
at db_1._jspService(db_1.java:80)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:500)
at org.apache.tomcat.core.Handler.service(Handler.java:223)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:448)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:911)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:824)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:152)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:438)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:505)
at java.lang.Thread.run(Thread.java:484)
DateBase Test
运行结果:
Error: 500
Location: /db.jsp
Internal Servlet Error:
javax.servlet.ServletException: [Microsoft][ODBC ???? ???] ???????
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:455)
at db_1._jspService(db_1.java:90)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:500)
at org.apache.tomcat.core.Handler.service(Handler.java:223)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:448)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:911)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:824)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:152)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:438)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:505)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.sql.SQLException: [Microsoft][ODBC ???? ???] ???????
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3266)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5377)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:320)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:376)
at db_1._jspService(db_1.java:80)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:500)
at org.apache.tomcat.core.Handler.service(Handler.java:223)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:448)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:911)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:824)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:152)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:438)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:505)
at java.lang.Thread.run(Thread.java:484)
|
前边至少加一句:rs.next()吧?
那一堆错误信息关键部分还是乱码,也不知道说什么
|
代码中少一段代码:rs.next();
试试看
试试看
|
你用的什么数据库?