JDBC Disconnects, Can't Reconnect
Feb 11, 2008
Hi,
Our environment is:
Windows Server 2003, Service Pack 2
SQL Server Express 2005
SQLServer JDBC driver 1.2
Sun JDK 1.6 (we tried this on JDK 1.5 as well)
There is no virus protection software on the host, and no firewall is enabled.
Our problem is that the JDBC connection running on the localhost periodically gets disconnected, and then we can't reconnect to the database at all, unless we physically power cycle the server. The error message we receive is: "Software caused connect on abort: recv failed"
This is a very strange situation, and to illustrate, I created the following command-line program:
public class DBTest {
public static void main(String[] arg) throws Exception {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn =
DriverManager.getConnection("jdbcqlserver://127.0.0.1:1433;databaseName=datamart",
"username", "password");
System.out.println("Connected");
conn.close();
}
}
Essentially, this program verifies that a database connection can be made to the SQL Server instance on the local host.
Executing this from the command line works the vast majority of the time.
However, once the Web application running on the same host encounters the JDBC disconnection issue, executing this program from the command line results in the following exception:
C:Documents and Settingsfrank>java -cp sqljdbc.jar;. DBTest
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: Software caused connect on abort: recv failed
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at DBTest.main(DBTest.java:7)
There is no way to obtain further access to the database, except by power-cycling the machine. Shutting down and then re-starting the SQL Server instance does not help, nor does restarting any individual process on the server.
Something permanently disables connection to the database server, and only a hard reset of the OS solves that problem.
Any suggestions would be most appreciated, as this is a serious, mission-criticial problem for us right now.
Thanks,
-- Frank
View 6 Replies
ADVERTISEMENT
Jul 7, 2006
Hi,
On my ASP.NET 2.0 application and SQL 2005 database server, i am using SQLDependency API to recieve notifications on the dataset changes from SQL 2005 server. I get the notification sucessfully (irrelevant of number of attempts).
So here's the problem, i wait for 3-4 mins and make sure that there is no activity on my web server. Now if the data changes the service broker fires the event (i validated through trace). But the notification is never received by my web application. It gets lost in between.
I read about this 'Abrupt client disconnects' problem in the article http://blogs.msdn.com/remusrusanu/archive/2006/06/17/635608.aspx but this didn't help much.
Also i sometimes see following messages in the profiler
<qnev:QNEvent xmlns:qnev="http://schemas.microsoft.com/SQL/Notifications/QueryNotificationProfiler"><qnev:EventText>broker error
intercepted</qnev:EventText><qnev:SubscriptionID>0</qnev:SubscriptionID><qnev:NotificationMsg><?xml version="1.0"?><Error
xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error"><Code>-8470</Code><Description>Remote service has been
dropped.</Description></Error></qnev:NotificationMsg><qnev:BrokerDlg>9EF36F45-E00D-DB11-85AB-0003FF0B72DB</qnev:BrokerDlg></qnev:QNEvent>
and also
<qnev:QNEvent xmlns:qnev="http://schemas.microsoft.com/SQL/Notifications/QueryNotificationProfiler"><qnev:EventText>broker error
intercepted</qnev:EventText><qnev:SubscriptionID>0</qnev:SubscriptionID><qnev:NotificationMsg><?xml version="1.0"?><Error
xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error"><Code>-8490</Code><Description>Cannot find the remote service
&apos;SqlQueryNotificationService-c0aac8a6-24a5-4a34-9d0f-0975538694c4&apos; because it does not
exist.</Description></Error></qnev:NotificationMsg><qnev:BrokerDlg>4A639911-ED0D-DB11-85AB-0003FF0B72DB</qnev:BrokerDlg></qnev:QNEvent>
Thanks,
Ashish
View 8 Replies
View Related
Apr 23, 2002
Hi,
I'm using Oracle 8.1.7 as linked server on SQL Server 2000. Everything works fine. But if is Oracle server is down while executing an query to linked server an errormessage is returned (correct).
When Oracle after that is available and I try to execute the query again the same errormessage is returned again. The only way is to restart the SQL Server.
Is there a better way to reconnect to linked server ???
Thanks.
View 1 Replies
View Related
Apr 18, 2008
Hi,
I'm testing performance of OPENROWSET,
I executed OPENROWSET 3 times in a sequence. But in Profiler i see only following events..
Audit Login
Batch Started
Batch Completed
RPC:Completed.
RPC:Completed.
:
:
:
:
RPC:Completed.
I'm intersted only to see if the login happens three time, but i'm not able to see that. Also, there was no Audit Logout.
Does SQL Server automatically pool connections ?
If i run Openrowset 3 times, shouldn't it open & close connection 3 times ?
Please clarify.
Thanks.
Sandeep.
View 3 Replies
View Related
Jul 20, 2005
I am having a problem executing long running queries from an ASP applicationwhich connects to SQL Server 2000. Basically, I have batches of queries thatare run using ADO in a loop written in VBScript. This works pretty welluntil the execution time of a single query starts to exceed some threshold,which I am trying to narrow down. I can typically run 2 - 10 queries in aloop, with the run time being anywhere from under a minute to an hour ormore. Now that this application is being subjected to run against some largedatabases (25 - 40G), I'm having problems getting the application tocontinue beyond the first query if it takes a while to run.I used SQL Profiler to try to diagnose what was going on. I can see thequery executes to completion, but immediately after completing I can see an"Audit Logout" message, which apparently means that the client hasdisconnected. The query durations vary from 45 or 50 minutes to up to over90 minutes. I have the ADO connection and query timeouts set to very largevalues, e.g. 1000 minutes, so I can't think its that. My guess is that thereis some IIS setting or timeout that I am running up against and theconnection to SQL Server is just dropped for some reason.The configuration isNT 4.0 SP6SQL Server 2000 SP3IIS 4.0Internet Explorer 5.5I'm only running into this problem on the very largest databases we runagainst. The vast majority continue to function properly, but this is goingto happen more often as time goes on the databases continue to grow in size.Any advice is appreciated,-Gary
View 4 Replies
View Related
Jan 26, 2007
I have an old application to maintain that uses CDatabase to connect to SQL Server. If SQL Server is stopped and restarted, such as in a cluster failover (i.e. move group), then the CDatabase connection needs to reconnect. It seems that it's not capable of doing this on it's own so I need to check the state some how. Various methods, such as IsOpen, seem to be useless as far as determining if I have a "good" connection.
Any thoughts?
View 3 Replies
View Related
Aug 22, 2005
I have an ODBC 3.0 Application on Windows NT Server maintaining aconnection to a SQL Server 2000 database on the same machine. When anerror occurs, I'd like to be able to determine whether the error isserious enough that the database connection has been lost, so I canhave the application try to reconnect automatically. My understandingis that any error of severity 20 or above includes a broken connection,but I'm having difficulty retrieving the error severity through ODBC.So my first question is, how do I retrieve the error severity throughODBC?Also, as a test, I stopped the database while my application is stillrunning, and the first error I received had a native error code of 55.There is no 55 error in the sysmessages table, so I'm confused as towhat the severity of the error is. Can anyone shed some light on why Iwould be receiving an error code that is not in the sysmessages table,and where I might be able to find more information about the error?Thanks in advance,Abram
View 2 Replies
View Related
Nov 3, 2006
I am trying to run the following:
select * from sysindexes
The operation begins and results are produced but after about 200 results, I get the error - Msg 0, Level 11, State 0, Line 0 - and it disconnects.
This is a DB moved (restored) from SQL 2000 to SQL 2005.
Any ideas would be appreciated. I am the "make do" DBA and not very good at it yet, I am afraid.
Regards,
Mike
View 8 Replies
View Related
Apr 14, 2008
I have read similar posts to this, but I am still having problems.
I am trying to use connection pooling to connect to a local SQL Server 2005 database. I am running my application using
MyEclipse Enterprise Workbench. I have verified that sqljdbc.jar resides in "WebRoot/WEB-INF/lib/"
"WebRoot/WEB-INF/web.xml":
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsichemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<resource-ref>
<res-ref-name>jdbc/DefaultDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
"WebRoot/META-INFcontext.xml":
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/DefaultDS"
auth="Container"
type="javax.sql.DataSource"
username="tec"
password="tec"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDrive"
url="jdbcqlserver://localhost:1433/tec;databaseName=tec;user=tec;password=test;"
validationQuery="select 1"
maxActive="10"
maxIdle="2"/>
</Context>
Classpath:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="com.genuitec.eclipse.j2eedt.core.J2EE14_CONTAINER"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/dom.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jaxen-full.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jaxp-api.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jdbc2_0-stdext.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/sqljdbc.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jstl.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mail.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/sax.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/saxpath.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/standard.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xalan.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xercesImpl.jar"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
Code to connect:
import java.io.Serializable;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
public int testConnect(){
Connection conn = null;
InitialContext ctx = null;
java.sql.Statement stmt = null;
try {
ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/DefaultDS");/*This is generating the Cannot load JDBC driver class... error*/
conn = ds.getConnection();
stmt = conn.createStatement();
return CONSTANT.SUCCESS;
} catch (Exception e) {
return CONSTANT.FAILURE;
}finally {
try {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
if (ctx != null)
ctx.close();
} catch (Exception ex) {
// do nothing
return CONSTANT.FAILURE;
}
}
}
Any ideas would be greatly appreciated.
View 17 Replies
View Related
Aug 8, 2006
Hi all,
We've just stumbled on a 1.0 version incompatibility with the JDBC specs.
Problem: A table with SMALLINT column. According to JDBC specs version 3.0
(p.B-179) and 4.0 (p.221)), the value should be converted to Integer type.
Unfortunatelly we get a Short object :(
Now, I remember, this case was also affecting old JSQLConnect driver from
DataDirect. Could that problem sneak to new MS driver too?
Please let me know any resolution to this problem if exists.
The issue has not been fixed in CTP 1.1 version. Any ideas if it can be fixed??
Cheers,
Piotr
View 1 Replies
View Related
Mar 12, 2008
I've got an import app written in Java. One table I'm importing from contains 22 million records. When I run the app in a 2000 environment, I have my max heap set at 512, and the table gets imported. When I run in a 2005 environment, I have to change the max heap to 1152 or it will error out with a similiar error:
com.microsoft.sqlserver.jdbc.SQLServerException: The system is out of memory. Use server side cursors for large result sets:Java heap space. Result set size:854,269,999. JVM total memory size:1,065,484,288. (<--this is with max heap at 1024)
what is the difference between the 2000 and 2005 JDBC that I have to set max heap in one and not the other?
View 3 Replies
View Related
Nov 26, 2001
Are there separate jdbc drivers for Sql Server 7 or should I use the 2000 drivers?
View 1 Replies
View Related
Aug 6, 2001
Is anyone out there using Unix/Java/Sun app server to connect to SQL Server via JDBC? If so, what drivers are you using? We are currently testing with WebLogic's BEA JDBC driver. Does anyone have any feedback on it?
View 2 Replies
View Related
Feb 6, 2004
Is oracle and Microsoft JDBC drivers are same? Oracle 9i comes with JDBC, can I use the same driver to access the Microsoft SQL Server?
View 1 Replies
View Related
Jun 1, 2004
Hi
I just downloaded the Microsoft JDBC Driver for SQL Server 2000. Now it tells me SQL Server 7 is not supported. :o I already checked the JDBC Driver list on suns site. Its quite long and only states MS SQL Server without any version number. Can you recommend a particular driver? Preferrably without any cost. :D
Or am I better of with the jdbc/odbc bridge?
Thanks
Shabassa
View 1 Replies
View Related
May 21, 2008
Hi
I have a java program which uses sql.It supports sql 2000 and 2005.The user can enter a command from which he can choose to what server type he wants to connect.It is something like :
" c:connect [jdbc driver for 2005] [server] "
Now i have to do some different operations when user connects to 2000 and other operations when user connects to 2005.
The problem is that when using jdbc driver for 2005 he can also connect to mssql server 2000.
How can i find out to what server type he is connecting to?
i hope i explained it clearly enough
thanks
View 1 Replies
View Related
Dec 7, 2004
Hi,
Does SQL Server Express ship with a JDBC driver? ... Hardly so, but is it available somewhere?
Rgds and thanks, PP
View 3 Replies
View Related
Mar 8, 2006
Hi guys,
Where can I download the JDBC Driver for our MS SQL Server 7 ?
Thank you.
View 3 Replies
View Related
Apr 5, 2006
this url is having problem while making connection to SQL Server
jdbc:XXX:sqlserver://<host>:1433;DatabaseName=<name>
error:
"The requested instance is either invalid or not running."
View 5 Replies
View Related
Jul 23, 2005
Hello all,I have a question about the SQL Server JDBC driver. I was wondering ifanyone knows what the default prefetch size is (in number of rows).Also, does anyone know if an entire packet is sent (i.e. padded withnull values) if there is not enough data to fill it?Thanks for your help!ty
View 2 Replies
View Related
Jul 20, 2005
I downloaded the latest version on JDBC from Microsoft and I got problems.Indeed, when fetching a smallint from SQL Server i got instead an Integer.How can i do to avoid such a problem?Some hints?many tanks, gaetano
View 1 Replies
View Related
Jul 20, 2005
I have a MSDE database that I am trying to connect to with JDBC. I don'thave SQL Server installed. Is this possible? When I try to connect I getthe error:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver forJDBC][SQLServer]Login failed for user 'sa'. Reason: Not associated with a trusted SQL Serverconnection.From what I've read on the web it looks like I need to set the securitysettings to allowfor SQL authentication as well as NT authentication. Is that correct? Andcan thatbe done with just MSDE?I think that I have MSDE 2000 installed (it actually came with a differentapplication).I just downloaded the latest SQL Server JDBC driver.Thanks,Bruce
View 1 Replies
View Related
Jul 20, 2005
I need a free, redistributable JDBC driverfrom MS SQL Server. (MSDE2000a)
View 2 Replies
View Related
Jul 20, 2005
Dear all,Where can I find JDBC for MS SQL server?Thx for reply.Victoria
View 2 Replies
View Related
Oct 2, 2006
what is the jdbc driver for sql express? is it "sqljdbc"? then what is its "complete" name in the class path:"com.microsoft.sqlexpress.sqljdbc"? and for the conection url is it "jdbc:microsoft:sqlexpress://localhost/sqlexpress"?
View 3 Replies
View Related
Jan 30, 2008
I started with a simple insert on one of my tables. It throws an exception for trying to place NULL in one of two calculated fields in the table.
I then tried setting up a simple stored procedure and calling it using:
CallableStatement statement = con.prepareCall("? = call dbo.AddSignedForms");
statement.registerOutParameter(1, java.sql.Types.INTEGER);
statement.execute();
Which generates this exception:
com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '@P0'.
of course there is no such expression in any of the code.
I then set up a simple two column table called tblTestJDBC. now i'm getting this error:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'dbo.tblTestJDBC'.
Btw we DID manage to get a simple select statement to work from my applet. Nothing else has. Is this the MS JDBC driver? Should I just avoid using it or are we missing something here?
View 10 Replies
View Related
Oct 12, 2006
The java code :
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"instance=SQLEXPRESS;databaseName=UPM;integratedSecurity=true;";
Connection con = DriverManager.getConnection(connectionUrl);
returns "connection refused" no matter what I do.
I've used the surface config tool to enable TCP, I've added sqlsrvr.exe to the firewall exceptions, I've tried a dozen or so variations on the connection string.
I can connect to the database using the Management Studio.
Any ideas what I'm missing ????
Thanks.
View 7 Replies
View Related
Sep 26, 2006
HI, all
I need to write a program, which using VM 1.1.8.
So I need to find the JDBC driver version 1.22, Can anyone help me???
Please Reply, a link for download jdbc 1.22 or any other solutions .
Thank you!
View 1 Replies
View Related
Nov 19, 2007
Hi Mixxo,
I also am having this problem! if you get an solution,
send me an answer or add my msn: griciolli@hotmail.com
View 1 Replies
View Related
Jan 18, 2001
please help it's urgent i badly need the jdbc driver for mssql for my project
thank u
View 1 Replies
View Related
Jul 10, 2007
Hi,
Am using Mcafee and it has a built in MSSQL Database. Am not able to get data frrom database. Can anyone let me know how to connect to Built in MSSQL database using JAVA? Need very quick reply. Any help is greatly appreciated.
thanks,
Jags
View 3 Replies
View Related
Jan 18, 2005
Hi at all, i'm new here, your communitiy seems too much preparated.
My question is simple...
i must to connect via jdbc to a ms sql server 2000 database, but i'm in doubt to select which jdbc driver to use. your suggest over microsoft'drivers? i found on the internet the open source drivers jdts...what about them?
thank you and excuse for by bad english! :p
View 2 Replies
View Related
Dec 30, 2003
I am having difficulty connecting to a SQL Server 7.0 database. I have an application running on JBoss 3.2.x, and which connects to an Oracle database without problem. However, I also need to have the application connect to a SQL Server 7.0 database.
I have a set of jar files which are added to my classpath for SQL Server. There were three jars (msutil.jar, msbase.jar and mssqlserver.jar) that had to be added to the classpath to get that far. However the application reported that the connection could not be established.
So, I wrote a java class to see if I could replicate the problem, or establish a connection and possibly figure out whether it was the application or the database. The class threw an exception and indicated that the driver was for SQL Server 2000, and was incompatible with SQL Server 7.0.
Has anyone used SQL Server 7.0 with JBoss and can point me in the right direction?
Thanks.
View 1 Replies
View Related