I am using an application with MS SQL 2005 Database + SQL Server 2005
jdbc driver.My application stops periodically becoz of Database
Connection Loss and I get the following exception
com.microsoft.sqlserver.jdbc.SQLServerException: An exception occurred
during the DBComms.transmit operation. Exception:Socket closed.
Context:(5) [Thread[Thread-55,5,main], IO:7e2dc, Dbc:null].
10:06:14:703 AM at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unkn
own Source)
10:06:14:703 AM at
com.microsoft.sqlserver.jdbc.DBComms.transmit(Unknown Source)
10:06:14:703 AM at
com.microsoft.sqlserver.jdbc.IOBuffer.sendCommand(Unknown Source)
10:06:14:703 AM at
com.microsoft.sqlserver.jdbc.SQLServerStatement.sendExecute(Unknown
Source)
10:06:14:703 AM at
com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteQuery(Unknown
Source)
10:06:14:703 AM at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unk
nown Source)
Unable to find the exact reason for the above problem.
pl advice
Thanks & Rgds
Roshini
*** Sent via Developersdex http://www.developersdex.com ***
I'd look at the network - local settings, routers and firewalls on the
route.
robert
You can get the driver version using this code:
------------------------------------------------------------
import java.*;
import java.sql.*;
import java.util.*;
import java.text.*;
class MSversion
{
public static void main(String[] args) throws Exception
{
// Load the JDBC driver
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// Connect to SQL Server
Connection conn = null;
String url = "jdbc:sqlserver://evanbagx620;DatabaseName=AdventureWorks2000;";
// Process the command line input
if (args.length == 0)
{
// Connect with default id/password
conn = DriverManager.getConnection(url, "username", "password");
}
else if (args.length == 2)
{
// Connect with user-provided username and password
String userName = args[0];
String password = args[1];
conn = DriverManager.getConnection(url, userName, password);
}
else
{
// Invalid command -> throw an exception
throw new Exception("\nUsage: java version [userName password]\n");
}
// Driver information
DatabaseMetaData dm = conn.getMetaData();
System.out.println("Connected to " + dm.getURL());
System.out.println("Driver Information");
System.out.println("\tDriver Name: " + dm.getDriverName());
System.out.println("\tDriver Version: " + dm.getDriverVersion());
System.out.println("\tDatabase Major Version: " + dm.getDatabaseMajorVersion());
System.out.println("\tDatabase Minor Version: " + dm.getDatabaseMinorVersion());
System.out.println();
// Cleanup
dm=null;
conn.close();
conn=null;
}
}
------------------------------------------------------------
Also, do you have a corresponding SQL Server error log? Do you see any corresponding errors?
Evan
--------------------
>From: Robert Klemme <short...@googlemail.com>
>Newsgroups: microsoft.public.sqlserver.jdbcdriver
>Subject: Re: Connection Reset Issue with MS SQL 2005
>Date: Fri, 23 Mar 2007 10:56:37 +0100
>Lines: 34
>Message-ID: <56hmi2F...@mid.individual.net>
>References: <uTfCLbQb...@TK2MSFTNGP04.phx.gbl>
>Mime-Version: 1.0
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>Content-Transfer-Encoding: 7bit
>X-Trace: individual.net X0QelJo7Uht19mAVkVJHPgWL7/jXUTBQD5lSzRIn06k7OGU4U=
>User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
>In-Reply-To: <uTfCLbQb...@TK2MSFTNGP04.phx.gbl>
>Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTFEEDS02.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!
newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
>Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.sqlserver.jdbcdriver:140
>X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver