D
Devron Blatchford
I have a question on when and where we should create connections to SQL.
I have a base class that handles all data access and dishes up connections
etc as needed. I initially had a class level connection object that all
general dataacess methods used to execute against. This introduced a problem
when using transactions and executing more than one on a connetion at a
time. I over cone this by creating a new connection each time I exeute a
method. When I do a trace on SQL I get many 'Audit login' events occuring as
the connections are being created. When I log out of my app and the
connections are being disposed I get many, many, many audit logouts. Is it
normal to create a new connection every time it is needed or is it better to
try and reuse an existing connection object if possible?. Maybe I can use IF
@@TRANCOUNT = 0 then use connection else create new one?
Thanks
Devron
I have a base class that handles all data access and dishes up connections
etc as needed. I initially had a class level connection object that all
general dataacess methods used to execute against. This introduced a problem
when using transactions and executing more than one on a connetion at a
time. I over cone this by creating a new connection each time I exeute a
method. When I do a trace on SQL I get many 'Audit login' events occuring as
the connections are being created. When I log out of my app and the
connections are being disposed I get many, many, many audit logouts. Is it
normal to create a new connection every time it is needed or is it better to
try and reuse an existing connection object if possible?. Maybe I can use IF
@@TRANCOUNT = 0 then use connection else create new one?
Thanks
Devron