• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic