Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, August 23, 2025 
 
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!
 Architect Forums - SalesLogix Scripting & Customization
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.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Open Database Connections
Rob Bartram
Posts: 98
 
Open Database ConnectionsYour last visit to this thread was on 1/1/1970 12:00:00 AM
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?


[Reply][Quote]
Jason Huber
Posts: 77
 
Re: Open Database ConnectionsYour last visit to this thread was on 1/1/1970 12:00:00 AM
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.
[Reply][Quote]
Dan Carvin
Posts: 227
 
Re: Open Database ConnectionsYour last visit to this thread was on 1/1/1970 12:00:00 AM
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.
[Reply][Quote]
Jason Huber
Posts: 77
 
Re: Open Database ConnectionsYour last visit to this thread was on 1/1/1970 12:00:00 AM
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.
[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/23/2025 3:43:18 AM