当前位置: 技术问答>java相关
大虾微电请进!!我已经按照要求将mssql的jdbc配好,并写了代码测试,但有问题不知如何解决!!?
来源: 互联网 发布时间:2015-10-27
本文导语: 您的第一个字段内容为: 您的第二个字段内容为: 这是我的jsp代码。。。 500 Servlet Exception java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Error ...
您的第一个字段内容为:
您的第二个字段内容为:
这是我的jsp代码。。。
500 Servlet Exception
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Error establishing
socket.
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at _index__jsp._jspService(/index.jsp:9)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:312)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:221)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163)
at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
at java.lang.Thread.run(Thread.java:536)
--------------------------------------------------------------------------------
Resin 2.1.4 (built Fri Aug 2 14:16:52 PDT 2002)
这是执行是出错的提示!!
我已经配好了classpath
D:Program FilesMicrosoft SQL Server 2000 JDBClibmssqlserver.jar;D:Program FilesMicrosoft SQL Server 2000 JDBClibmsbase.jar;D:Program FilesMicrosoft SQL Server 2000 JDBClibmsutil.jar
并且又把三个jar文件放到了web-inf/lib中,但是还是出错,这是为什么!!??
请指教!不胜感激!!
|
Connection conn = DriverManager.getConnection
("jdbc:microsoft:sqlserver://server1:1433","username","secret");
NOTE:
The server_name is an IP address or a host name, assuming that your network resolves host names to IP addresses. You can test this by using the ping command to access the host name and verifying that you receive a reply with the correct IP address.
The numeric value after the server name is the port number on which the database is listening. The values listed here are sample defaults. You should determine the port number that your database is using and substitute that value.
("jdbc:microsoft:sqlserver://server1:1433","username","secret");
NOTE:
The server_name is an IP address or a host name, assuming that your network resolves host names to IP addresses. You can test this by using the ping command to access the host name and verifying that you receive a reply with the correct IP address.
The numeric value after the server name is the port number on which the database is listening. The values listed here are sample defaults. You should determine the port number that your database is using and substitute that value.
|
不是大虾,也来看看
********************
你这里的异常是SQLException,而非ClassNotFoundException,所以不是你设置classpath的问题,关键是在取字段那,你把这两句屏蔽掉看看
您的第一个字段内容为:
您的第二个字段内容为:
或者改为
您的第一个字段内容为:
您的第二个字段内容为:
********************
你这里的异常是SQLException,而非ClassNotFoundException,所以不是你设置classpath的问题,关键是在取字段那,你把这两句屏蔽掉看看
您的第一个字段内容为:
您的第二个字段内容为:
或者改为
您的第一个字段内容为:
您的第二个字段内容为:
|
继续往上屏蔽,看看出错是什么语句.数据库启动没,
|
我把你的代码改了一点放在我的机器上运行没有问题
环境:jdk1.3
1、tomcat
2、WebLogic
3、Resin
您的第一个字段内容为:
您的第二个字段内容为:
环境:jdk1.3
1、tomcat
2、WebLogic
3、Resin
您的第一个字段内容为:
您的第二个字段内容为: