Load Ingest Data
Results 1 to 3 of 3

Thread: Attunity Thin_ADO.NET1.1_Client to connect to DB2

  1. #1
    Betty Sullivan is offline Junior Member
    Join Date
    Sep 2006
    Posts
    12
    Rep Power
    0

    Attunity Thin_ADO.NET1.1_Client to connect to DB2

    The ado .net client is throwing an exception in .NET:

    The type initializer for 'Attunity.Data.Common.PerformanceCounterHelper' threw an exception.

    How can I figure out what caused the error? I can't find any reference in your documentation about the PerformanceCounterHelper. Is there documentation about the Thin Client?

  2. #2
    Join Date
    Sep 2006
    Posts
    233
    Rep Power
    10
    The information provided is not enough to figure out why you get an exception. The class mentioned is an internal class and as such, it is not documented. The installation registers it with the system so that you can get various conters via the standard WMI interfaces. If the performance counters get unregistered, then this class does nothing.

    I have not seen this error before. Information on the calling program (stand-alone, component, etc.) and the calling code and logs is likely to help in finding an answer.
    Last edited by DrorHarari; 02-15-2007 at 12:19 PM.
    By Dror Harari

    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  3. #3
    Betty Sullivan is offline Junior Member
    Join Date
    Sep 2006
    Posts
    12
    Rep Power
    0

    Attunity Thin_ADO.NET1.1_Client to connect to DB2

    the AisConnection class from Ais.Attunity.dll doesn't closes the connection when the connection is pooled.
    Where is it maintaining the maximum number of connection pools? Is this something we can control from the .NET code that uses the dll or not?


    public void Close()
    {
    TraceHelper.TraceVerbose("AisConnection", "Enter Close()");
    if (!this.IsClosed)
    {
    AisConnection connection1;
    Monitor.Enter(connection1 = this);
    try
    {
    lock (this.innerConnection)
    {
    this.innerConnection.DisposeTransaction();
    TraceHelper.TraceVerbose("AisConnection", "innerConnection.DisposeTransaction()");
    TraceHelper.TraceVerbose("AisConnection", "innerConnection.DisposePreparedCommands()");
    this.innerConnection.DisposePreparedCommands();
    TraceHelper.TraceVerbose("AisConnection", "innerConnection.Pooled = " + this.innerConnection.Pooled);

    //This is where it decides to close or not to Close,

    // if connection is pooled it DOES NOT call this.innerConnection.Disconnect();

    if (this.innerConnection.Pooled)
    {
    TraceHelper.TraceVerbose("AisConnection", "Get Connection Pool");
    ConnectionPool pool1 = PoolManager.Instance.FindPool(this.connectionStrin g);
    TraceHelper.TraceVerbose("AisConnection", "Send connection to the Pool");
    pool1.CheckIn(this.innerConnection);
    }
    else
    {
    TraceHelper.TraceVerbose("AisConnection", "Disconnect connection");
    this.innerConnection.Disconnect();
    PerformanceCounterHelper.DecrementNotPooledConnect ions();
    }
    }
    this.OnStateChange(this.state, 0);
    }
    catch (Exception exception1)
    {
    throw new AisException(exception1.get_Message(), exception1);
    }
    finally
    {
    Monitor.Exit(connection1);
    }
    TraceHelper.TraceVerbose("AisConnection", "Exit Close()");
    }
    }

    Even if we will release the connection object from the class, it will not release the connection object , if it is in connection pool.
    I tried clearing the connection pool from GetDB2RowsForSqlStmt method of WorkFlowTestHelper, but I am not sure if that's the right solution.
    Public Shared Function GetDB2RowsForSqlStmt(ByVal sql As String) As Integer

    ' Create a new command with parameters for the data
    Using dbCmd As New AisCommand
    ' dbCmd = New AisCommand
    dbCmd.CommandText = sql

    Dim prin As AEPrincipal = AEPrincipal.GetCurrent()
    Dim strConn As String = ProviderHelper.GetDb2ConnectionString(prin)

    dbCmd.Connection = New AisConnection(strConn)
    dbCmd.CommandType = CommandType.Text

    ' Execute the call
    dbCmd.Connection.Open()
    dbCmd.Prepare()

    Dim returnVal As Integer = -1
    Integer.TryParse(dbCmd.ExecuteScalar().ToString(), returnVal)

    AisConnection.ClearPool(dbCmd.Connection)

    dbCmd.Connection.Close()
    dbCmd.Connection.Dispose()

    If (Not dbCmd.Connection Is Nothing) Then
    dbCmd.Connection = Nothing
    End If
    Return returnVal
    End Using
    End Function

Posting Permissions

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