Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: I/O Error: DB server closed connection.

 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am unable to connect to MSSQL 2000 database it gives me stack of errors, my code says

a.java-----------

import java.sql.*;

public class a
{
public static void main(String[] args)
{
try

{

Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection conn = DriverManager.getConnection(


"jdbc:jtds:sqlserver://localhost:8080/REGISTRATION_TEMP_LTR_PRINT","sa","water");
System.out.println("connected");

}

catch (Exception e)

{
e.printStackTrace();
}
}
}

and on execution the error i get is

java.sql.SQLException: I/O Error: DB server closed connection.
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2307)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:602)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java
:344)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java
:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at a.main(a.java:12)
Caused by: java.io.IOException: DB server closed connection.
at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:8
43)
at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java
:722)
at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.jav
a:466)
at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:103
)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2202)
... 7 more

any suggestions on this...
i included my jtds jar file in the classpath ... i dont no whats the problem.
On surfing i got a suggestion to add ssl=request in the url and i am not sure where to add it please help............
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i myself could solve it ..... i need to change my localhost to the server name of my sql server and the port number to 1433 which is the default port number for mssql server.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic