Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2013

    Unanswered: Disconnect from database

    I am using the Informix ODBC driver version 3.01 to connect to a Primac database via a DSN using VB 6. My connection string is:

    strUniConn = "PROVIDER=MSDASQL;dsn=PRIMAC_TEST;uid=" & strUID & ";pwd=" & strPWD & ";"

    I connect to the database, retrieve information, and then close the connection. However in the database, the connection is not dropped until the program has been inactive for 90-100 seconds. Does anyone know how to make this drop quicker?

  2. #2
    Join Date
    Mar 2013
    Here's a bit more info about this issue. The function I'm running is:

    Private Function GetPrimacConnection(strUID As String, strPWD As String, ByRef strError As String) As Boolean
    On Error GoTo ErrorPrimac
    Dim unidb As ADODB.Connection
    Dim strCommand As String
    strCommand = Command()
    strUniConn = "PROVIDER=MSDASQL;dsn=PRIMAC_QA;uid=" & strUID & ";pwd=" & strPWD & ";"
    Set unidb = New ADODB.Connection
    With unidb
    .CursorLocation = adUseClient
    .ConnectionString = strUniConn
    .Open ' Opening the database successfully proves that the user is valid.
    End With
    GetPrimacConnection = True
    Set unidb = Nothing
    Exit Function
    strError = Err.Description
    GetPrimacConnection = False
    If Not unidb Is Nothing Then
    If Not unidb.State = adStateClosed Then
    End If
    Set unidb = Nothing
    End If
    End Function

    After the function is complete, the user ID remains logged in to the database for about 90 seconds. I'd like the connection to drop sooner - immediately if possible. This is tying up a database license for 90 seconds even though it's not needed. FYI, if the program is closed, the connection drops immediately.

    TIA for suggestions.

  3. #3
    Join Date
    Mar 2012
    Somewhere In Europe
    Hi KMartin

    When odbc connection is first opened against a database, a connection pool is created.
    If you close the session from you app to Informix DB, a connection is still active between provider and the Informix instance an waits to be reused within the same process.

    Please try to change pooling configuration on driver level.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts