This is a technical question, in msdn, the Connection class is described as follows:
The Connection class establishes a current database session that you can use to execute SQL statements and return results.
The UserConnection class is described as:
The UserConnection class represents an auxiliary connection to the SQL database, based on the same login properties as the main connection.
What is the practical difference between these two classes?
I'm currently trying to determine why certain connections are being 'stranded' in AX 2012 with blocking happening. One recent change made to AX was to implement a report that makes calls to external stored procedures using the connection class. I then close the resultset and statement objects. The pseudo code looks like the following:
try
{
//BP Deviation Documented
sql = strFmt("StoredProc1 %1,%2",_salesId,_lineNum); sqlPerm = new SqlStatementExecutePermission(sql);
sqlPerm.assert();
connection = new Connection();
statement = connection.createStatement();
sqlres = statement.executeQuery(sql);
CodeAccessPermission::revertAssert();
while(sqlres.next())
{
var1 = strLwr(sqlres.getString(1));
var2 = strLwr(sqlres.getString(2));
}
sqlres.close();
statement.close();
}