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

  • 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

  • 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


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

  • 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


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply