Jaa


UserConnection Class

Definition

The UserConnection class represents an auxiliary connection to the SQL database, based on the same logon properties as the main connection.

public ref class UserConnection : Dynamics::AX::Application::Connection
[Microsoft.Dynamics.Ax.Xpp.KernelClass]
public class UserConnection : Dynamics.AX.Application.Connection
[<Microsoft.Dynamics.Ax.Xpp.KernelClass>]
type UserConnection = class
    inherit Connection
Public Class UserConnection
Inherits Connection
Inheritance
Microsoft.Dynamics.AX.KernelInterop.ProxyBase
UserConnection
Attributes

Remarks

SQL statements are executed, and results are returned in the context of a UserConnection class. The UserConnection class can be used to obtain a separate transaction scope.

Note: Userconnection.finalize() needs to be called in the finally block to prevent user connection leak. Number of open user connections is limited on the server, when it reaches the limit, no more connections can be opened, which can leads to business logic failures

The following code example demonstrates the UserConnection class.

static void example()  
{ 
    UserConnection Con;
    try
    {
        Statement Stmt; 
        Str sql; 
        ResultSet R; 
        SqlStatementExecutePermission perm; 
        Con = new UserConnection(); 
        sql = 'SELECT VALUE FROM SQLSYSTEMVARIABLES'; 
        Stmt = Con.createStatement(); 
        perm = new SqlStatementExecutePermission(sql); 
        // Check for permission to use the statement. 
        perm.assert(); 
        R = Stmt.executeQuery(sql); 
        while ( R.next() ) 
        { 
            print R.getString(1); 
        } 
    }
    finally
    {
        con.finalize();
    }
 }

Constructors

UserConnection()
UserConnection(Boolean)
UserConnection(IntPtr)

Fields

kernelClass (Inherited from XppObjectBase)

Methods

__shouldCallNew(Type)
addXppProxyReference(Type, Object) (Inherited from XppObjectBase)
Call(String, Object[], Type[], Object[]) (Inherited from XppObjectBase)
cancelTimeOut(Int32) (Inherited from XppObjectBase)
createKernelClass(Object[], Type[], Object[]) (Inherited from XppObjectBase)
createStatement()

Creates a Statement object that is used to execute an SQL statement.

(Inherited from Connection)
createStatement(ResultSetType, ResultSetConcurrency) (Inherited from Connection)
createStatement(ResultSetType) (Inherited from Connection)
equal(XppObjectBase) (Inherited from XppObjectBase)
finalize()
GetIntPtr()
GetKernelInstanceUniqueId() (Inherited from XppObjectBase)
getTimeOutTimerHandle() (Inherited from XppObjectBase)
getXppProxyReference(Type) (Inherited from XppObjectBase)
handle()
isInTransactionScope() (Inherited from Connection)
IsManagedValid()
kernelhandle()
KernelInstanceDisposed() (Inherited from XppObjectBase)
MakeReflectionCall(String, Object[]) (Inherited from XppObjectBase)
newmethod()

Initializes a new instance of the Connection class.

newmethod(Boolean)
notify() (Inherited from XppObjectBase)
notifyAll() (Inherited from XppObjectBase)
objectOnServer()
Obsolete.
(Inherited from XppObjectBase)
odbcGetInfoInt(Int32)

Provides an interface to the SQLGetInfo Open Database Connectivity (ODBC) function to retrieve information about the ODBC driver and data source that are associated with a connection.

(Inherited from Connection)
odbcGetInfoLong(Int32)

Provides an interface to the SQLGetInfo ODBC function to retrieve information about the ODBC driver and data source that are associated with a connection.

(Inherited from Connection)
odbcGetInfoStr(Int32)

Provides an interface to the SQLGetInfo ODBC function to retrieve information, in string format, about the ODBC driver and data source that are associated with a connection.

(Inherited from Connection)
setTimeOut(String, Int32, Boolean)
Obsolete.
(Inherited from XppObjectBase)
setTimeOut(String, Int32)
Obsolete.
(Inherited from XppObjectBase)
ToString()

Converts the Connection object to a string.

(Inherited from Connection)
transactionScopeAbort() (Inherited from Connection)
transactionScopeBegin() (Inherited from Connection)
transactionScopeCommit() (Inherited from Connection)
ttsabort()

Discards changes that are associated with a transaction and rolls the database back to the original state.

(Inherited from Connection)
ttsbegin()

Begins a transaction.

(Inherited from Connection)
ttscommit()

Commits the changes that are associated with a transaction to the database.

(Inherited from Connection)
ttsLevel()

Returns the number for the last call to the ttsbegin method that is used to begin a transaction.

(Inherited from Connection)
ttsNotifyAbort()

Is called when an exception is thrown.

(Inherited from Connection)
ttsNotifyBegin() (Inherited from Connection)
ttsNotifyCommit()

Is called when the ttscommit method is called.

(Inherited from Connection)
usageCount() (Inherited from XppObjectBase)
VerifyKernelClass() (Inherited from XppObjectBase)
wait() (Inherited from XppObjectBase)
Xml() (Inherited from XppObjectBase)
Xml(Int32) (Inherited from XppObjectBase)

Applies to