Subject: Best way to connect to the data base Is it Appl...
Posted By: jojys Post Date: 10/20/2004 12:16:36 AM
What is the best way of connecting to a database? Is it creating an application level variable which is shared by all users ? Or is it a session level variable for each session ? Or is it a connection in each procedure ? Or Should it be like opening the connection when the database is accessed and closing it immediately which means multiple opening and closing in the same procedure.

I am really confused.  Somebody please help

Jojy
Reply By: happygv Reply Date: 10/20/2004 9:23:28 AM
Hi Jojy,

IMO, It is good to have the connection open only when the DB access is required and close that once you are done with DB operations. If there is a sequence of opetations to be done with the database within a procedure/function, then it might be good that open the connection once the control enters the procedure and close that before the control exits from there. So far I have been sticking to this way of approach. But should be careful in closing connection then and there after use.

When Application/Session level db connection are used, then the connection per user is open till the time user quits the site, even when the user is roaming around the static pages.

May be you would get good inputs from others in this forum too.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection

Go to topic 20956

Return to index page 739
Return to index page 738
Return to index page 737
Return to index page 736
Return to index page 735
Return to index page 734
Return to index page 733
Return to index page 732
Return to index page 731
Return to index page 730