3/17/2026 5:28:26 AM
|
| |
| slxdeveloper.com Community Forums |
|
| |
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Open Database Connections
Posted: 03 Mar 08 11:03 AM
|
While reviewing some custom code, I came across the following code:
Dim objCN Set objCN = Application.GetNewConnection
some code using objCN
Set objCN = CreateObject("ADODB.Connection")
some code using the new objCN.
objCN.close set objCN = nothing
The objCN is not closed before establishing the new connection. My question is, what happens to the first connection? Is it still hanging open? Perhaps, this can explain some weird random events that have been hapening.
Is there a way to view all open DB connections from the client?
|
|
|
|
Re: Open Database Connections
Posted: 04 Mar 08 6:40 AM
|
Dim objCN Set objCN = Application.GetNewConnection is correct
Set objCN = CreateObject("ADODB.Connection") isnt needed given the above code - especially AFTER the above code. unless it is connecting to a different db - is it?
IMO the first connection would "hang open" until it was cleaned up by the db - this can be tested and in SLX there isnt really a new connection to the db created since this connection in this code is really to the slx server - not the db. This shouldnt explain any weird nor random events however - just lots of open connections to the db potentially slowing things down - but I doubt it in SLX since again you are connecting to the SLX server and not to the DB.
As long as the actual connection is closed then you are ok on the client as far as leaks go.
|
|
|
|
Re: Open Database Connections
Posted: 05 Mar 08 10:17 AM
|
Does the second objCN "overwrite" the first?
I could see errors happening when the second objCN is to a different DB and commands intended for the first DB appear after the second connection is created, and if a second objRS is created before work on the first is completed and the .close command made. |
|
|
|
Re: Open Database Connections
Posted: 05 Mar 08 11:26 AM
|
Good point Dan.
I never use anything like rs.update or rs.addnew, and I almost always use forward only, readonly so I didnt consider that. |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|