Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Connection Pooling

Author  Topic 

nizmaylo
Constraint Violating Yak Guru

258 Posts

Posted - 2001-09-05 : 16:17:40
Enclosed is my code for connection object
I have the following questions:
1) What’s the best way to register the objects: using regsvr32 or as COM+ application?
2) If the answer is COM+, what are the advantages?
3) Shall I initialize the object in glabal.asa giving it application level scope or on each page? If the object is being initialized in global.asa, is there a high possibility that it will slow down performance?
4) If the object is initialized on each page, how is the connection pooled? Will two different users be able to reuse the same object?
Appreciate any practical help. There is a lot written on the subject, but …
Environment: MS Windows 2000 Server, SQL Server 2000

Option Explicit
Dim myObjConn As ADODB.connection

Private Sub Class_Initialize()
Set myObjConn = New ADODB.connection
Dim strConn
strConn = "Driver={SQL Server}; Server=server_name; Database=database_name; UID=user_id; PWD=password"
myObjConn.Open strConn
End Sub


Private Sub Class_Terminate()
If Not myObjConn Is Nothing Then
If myObjConn.State <> 0 Then myObjConn.Close
Set myObjConn = Nothing
End If
End Sub


helena
   

- Advertisement -