Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Error 3709 The connection cannot be used to perform this operation. It is either closed or invalid in this contex Expand / Collapse
Author
Message
Posted Tuesday, March 15, 2005 8:15 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 16, 2011 11:21 AM
Points: 169, Visits: 559

I'm just the DBA so I'll try to explain this with out making a fool of myself...

We have an application that currently runs in production and has a NT/SQL 7.0 backend.  We'll call it "server".  We are trying to migrate to a Windows2K/SQL2K server currently named "newserver".  We have no issues in the current prod. environment or testing in the new environment.  Our goal is to move the database and rename, take "server" offline and rename "newserver" to "server".

The production application is able to initially connect but receives:

Error 3709 The connection cannot be used to perform this operation. It is either closed or invalid in this context.

when the users go to use any of the functions of the app.

Thanks




Post #167775
Posted Wednesday, March 16, 2005 6:09 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:44 AM
Points: 12,905, Visits: 32,158

I typically see this when an ADODB connection has not been opened, and then you try to open a recordset with the still closed connection;

for example:

dim conn As New ADODB.Connection

conn .ConnectionString = Provider=SQLOLEDB;Persist Security Info=False;User ID=sa;Password=unknown;Initial Catalog=pubs;Network Library=dbmssocn; Data Source=someserver;   

conn .CursorLocation = adUseClient

'--commented out to duplicate error!

'conn.Open

 dim rs as new adodb.recordset

rs.Open "SELECT * FROM AUTHORS", conn, adOpenStatic, adLockReadOnly

 

--THIS WILL RAISE THE ERROR BECAUSE THE CONNECTION IS NOT OPEN

In an app I had, the connection was opened in a separate procedure with on error resume next, and then a different procedure, which assumed the conn was .Open would raise the same error, because the previous connection failed error was supressed.

 

hope that helps



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #167995
Posted Wednesday, March 16, 2005 6:42 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 16, 2011 11:21 AM
Points: 169, Visits: 559

Thanks Lowell.  I've forwarded this on to the developers.  Here's a little more detail:

The production code works without issue using the production web server and SQL 7.0

We also moved the production code to the dev. web server and ran it against the new sql2k server with out a problem.

We are only seeing the error when running the prod. code on the prod. web server against the sql2k server after we did the rename of that sql server (took sql 7.0 server off line and rename the sql2k server to the 7.0 name... no code changes.)

Once we renamed the sql server we were able to run the app. from the dev. web server with out any problem.

It all seems to be pointing to an issue with the prod. web server...




Post #168001
Posted Wednesday, March 16, 2005 1:08 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:44 AM
Points: 12,905, Visits: 32,158

i would bet that a connection string is incorrect when it is moved to production...

I don't know your app of course, but if the connections string is hardcoded to look for a specific machine name, ip address, database name,  then it might fail;

check the basics of the connection string:

from the production machines perspective,

does the server exist?

database name exist?

user exist?

user have permissions to the database in question?

user can log into the db From query analyzer with the password supplied?



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #168159
Posted Thursday, March 17, 2005 1:35 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 16, 2011 11:21 AM
Points: 169, Visits: 559

For what ever reason the prod. IIS server is using multiprotical... I went to server network utility and everything is gravy.

Thanks for the suggestions... my programming career is officially over!




Post #168521
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse