This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes java.sql.SQLException: I/O Error: DB server closed connection. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "java.sql.SQLException: I/O Error: DB server closed connection." Watch "java.sql.SQLException: I/O Error: DB server closed connection." New topic
Author

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

carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

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

Joined: Jun 23, 2007
Posts: 300

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.
 
Have you checked out Aspose?
 
subject: java.sql.SQLException: I/O Error: DB server closed connection.
 
It's not a secret anymore!