Is it very difficult to connect to SQLServer Database using
JDBC Driver in XP operation system?Today I try to connect,but I failed.I registed a user and I give all the rights to it.But I use this user to connect.I failed.
The part of my code is:
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
System.out.println("success");
}
catch (Exception e) {
System.out.println("fail");
}
Connection con=null;
Statement stat=null;
ResultSet rs;
try{
String URL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=DangAnGuan";
con=DriverManager.getConnection(URL,"king","2812986");
stat = con.createStatement();
}catch(SQLException e)
{
System.out.println("There is a Problem");
e.printStackTrace();
}
The fail tips are:
success
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
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.<init>(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 com.heaton.bot.SpiderWorker.SaveBulletin(SpiderWorker.java:237)
at com.heaton.bot.SpiderWorker.processBulletin(SpiderWorker.java:112)
at com.heaton.bot.SpiderWorker.processWorkload(SpiderWorker.java:41)
at com.heaton.bot.SpiderWorker.run(SpiderWorker.java:32)
There is a problem.
What's wrong?I don't know.Could you tell me?Thank you!
[ November 17, 2005: Message edited by: Bear Bibeault ]