I would like to know what is best (in terms of performance and memory, and programming practice) for opening connections to a SQL database.
I have an activity which accesses a SQL database, so in Process_Globals I have:
Dim SQL1 as SQL
From what I understand, everthing in my app now has access to that connection.
I also have a service which will attach to the same database at intervals. Plus I have a class which I use within other Activities and it has its own connection to the same database.
All could potentially be accessing the database at the same time.
So my question is:
Should all be referring to SQL1 which was defined in MAIN and leave the SQL connection open (never close it) basically just having 1 shared connection to the database?
Or should I use a seperate Initialize and Close for each activity/class, effectively having multiple, seperate connections to the database.
I have an activity which accesses a SQL database, so in Process_Globals I have:
Dim SQL1 as SQL
From what I understand, everthing in my app now has access to that connection.
I also have a service which will attach to the same database at intervals. Plus I have a class which I use within other Activities and it has its own connection to the same database.
All could potentially be accessing the database at the same time.
So my question is:
Should all be referring to SQL1 which was defined in MAIN and leave the SQL connection open (never close it) basically just having 1 shared connection to the database?
Or should I use a seperate Initialize and Close for each activity/class, effectively having multiple, seperate connections to the database.