The moose likes JDBC and the fly likes Problem with SQLServer/Data Direct Driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem with SQLServer/Data Direct Driver" Watch "Problem with SQLServer/Data Direct Driver" New topic

Problem with SQLServer/Data Direct Driver

Mike Finger

Joined: Sep 30, 2003
Posts: 5
I was wondering if anyone out there in Java land could confirm/deny the following:
from http://dbforums.com/arch/30/2003/7/529049

Apperently with the MSSQL jdbc driver (and also the Data Direct Driver) you cannot close a connection twice. If you do so, something will get screwed in the driver. It wont show up all the time, just when you push the driver. So check your code and make sure you don't close a connection twice.

I spent alot of time going thru the microsoft and data direct web sites and couldn't find anything...
It appears that I'm experiancing this, but am trying to confirm the bug.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Calling the method close on a Connection object that is already closed is a no-op.

Mike Finger

Joined: Sep 30, 2003
Posts: 5
According to the java api it's supposed to be a no-op --
The bug seems to be that it isn't a no-op..
The stack trace I'm getting when I try to close the connection is:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.validateClosedState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.validateClosedState(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.clearParameters(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.close(Unknown Source)
at com.svtechnology.database.DBConnectionBitMechanic.destroy(DBConnectionBitMechanic.java:297)
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Well it is a bug.
Ryan Burgess

Joined: Aug 29, 2004
Posts: 1
My company has experienced this issue as well. Specifically when a result set is closed twice. Guess it hasn't been fixed yet.

Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
I was chatting to a friend of mine the other day. I said to him, "When I do this it really hurts!"

He gave me some great advice, which I'll never forget: he said, "Don't do that then! "

I agree. Here's the link: http://aspose.com/file-tools
subject: Problem with SQLServer/Data Direct Driver
Similar Threads
Servlet hang when performing to much insert function
How to select resultset in range?
Auto Generate Primary Key
Urgent : JDBC Driver for MS SQL Server 7
How does PreparedStatement.setObject() API behaves with null value?