当前位置: 技术问答>java相关
(100分)jdbc连接sqlserver 200出错.[SQLServer 2000 Driver for JDBC]Error establishing socket.
来源: 互联网 发布时间:2015-08-20
本文导语: dbc连接sqlserver 200出错.java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. 此为何解?当然class.forname("com.microsoft.........")还显示驱动程序配置正确 是否我sqlserver2000服务器的问题? import javax.s...
dbc连接sqlserver 200出错.java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
此为何解?当然class.forname("com.microsoft.........")还显示驱动程序配置正确
是否我sqlserver2000服务器的问题?
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.io.*;
import java.util.*;
public class testms extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse resp)
throws ServletException, java.io.IOException
{
java.io.PrintWriter out =new java.io.PrintWriter(resp.getOutputStream());
resp.setContentType("text/html;charset=gb2312");
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
out.println("数据库驱动程序正确...");
}
catch(ClassNotFoundException ey)
{
out.println("数据库驱动程序没找到!......");
}
catch(Exception ex)
{
out.println("数据库驱动程序没找到!.......");
}
try
{
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://10.42.0.1:1433","sa","sapassword");
out.println("数据库驱动URL正确.....");
}
catch(SQLException ey)
{
out.println(ey.toString());
}
out.close();
}
}
/*************************************************************/
我的sqlserver2000装完未作任何设置更改.
远程用sqlserver 2000 client可以用主机名登录,看起来好像TCP/IP连接没启呢?
怎么回事?望大侠赐教
此为何解?当然class.forname("com.microsoft.........")还显示驱动程序配置正确
是否我sqlserver2000服务器的问题?
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.io.*;
import java.util.*;
public class testms extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse resp)
throws ServletException, java.io.IOException
{
java.io.PrintWriter out =new java.io.PrintWriter(resp.getOutputStream());
resp.setContentType("text/html;charset=gb2312");
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
out.println("数据库驱动程序正确...");
}
catch(ClassNotFoundException ey)
{
out.println("数据库驱动程序没找到!......");
}
catch(Exception ex)
{
out.println("数据库驱动程序没找到!.......");
}
try
{
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://10.42.0.1:1433","sa","sapassword");
out.println("数据库驱动URL正确.....");
}
catch(SQLException ey)
{
out.println(ey.toString());
}
out.close();
}
}
/*************************************************************/
我的sqlserver2000装完未作任何设置更改.
远程用sqlserver 2000 client可以用主机名登录,看起来好像TCP/IP连接没启呢?
怎么回事?望大侠赐教
|
from
PRB: Error Establishing Socket with JDBC Driver
http://support.microsoft.com/search/preview.aspx?scid=kb;en-us;Q313178
1. The server name or IP address is incorrect.
2. The server name is correct, but the server is not running.
3. The server name is correct and it is running, but the server does not have TCP/IP enabled.
4. The server name is correct, the server is running and TCP/IP is enabled, but you have specified the incorrect port number in your JDBC connection URL.
5. If the problem is intermittent, it might be due to network problems or due to server problems (for example, the server is occasionally too busy to accept a connection). When the problem occurs, check to see if you can connect to the same server instance from another client, such as SQL Query Analyzer. It may also be useful to use a Network Sniffer such as Network Monitor (NetMon) to monitor traffic between the client and the server to determine if there is a network problem.
6. If the problem is not intermittent, it might still be a network configuration problem. For example, you may be behind a firewall that blocks certain ports.
PRB: Error Establishing Socket with JDBC Driver
http://support.microsoft.com/search/preview.aspx?scid=kb;en-us;Q313178
1. The server name or IP address is incorrect.
2. The server name is correct, but the server is not running.
3. The server name is correct and it is running, but the server does not have TCP/IP enabled.
4. The server name is correct, the server is running and TCP/IP is enabled, but you have specified the incorrect port number in your JDBC connection URL.
5. If the problem is intermittent, it might be due to network problems or due to server problems (for example, the server is occasionally too busy to accept a connection). When the problem occurs, check to see if you can connect to the same server instance from another client, such as SQL Query Analyzer. It may also be useful to use a Network Sniffer such as Network Monitor (NetMon) to monitor traffic between the client and the server to determine if there is a network problem.
6. If the problem is not intermittent, it might still be a network configuration problem. For example, you may be behind a firewall that blocks certain ports.
|
sqlserver 2000 client配一下连接方式,启动TCPIP连接就好了。
|
默认的好像是管道命名,用主机名试没问题的。
|
我想可能是你登录WINDOWS的密码,和你的SQL密码不一样,