|
今日测试 Microsoft SQL Server 2008 R2 Express (下载链接: http://www.microsoft.com/zh-cn/download/details.aspx?id=23650) 连接数:
测试代码:- Option Explicit
- Const CONNSTR = "Provider=SQLOLEDB;Data Source=192.168.33.2,1435;User ID=sa;Password=******;Initial Catalog=master"
- Const POOL = ";Pooling=true;Max Pool Size=40000;Min Pool Size=0;"
- Dim i As Long
- Dim col As New Collection
- Private Sub Command1_Click()
- On Error GoTo err_handle
- Dim conn As ADODB.Connection
- Dim cs As String
- cs = Me.Text2
-
- If Me.Check1.Value = 1 Then
- cs = cs & POOL
- End If
-
- i = 0
-
- Do While True
- DoEvents
- Set conn = New ADODB.Connection
- conn.Open cs
- col.Add conn
- i = i + 1
-
- Me.Text1 = i
- Loop
- Exit Sub
-
- err_handle:
- MsgBox "Down!" & vbNewLine & vbNewLine & Err.Number & " -- " & Err.Description
- Err.Clear
- End Sub
- Private Sub Command2_Click()
- Dim c As ADODB.Connection
- For Each c In col
- c.Close
- Set c = Nothing
- Next
-
- Dim i As Long
- Dim t As Long
- t = col.Count
- For i = t To 1 Step -1
- col.Remove i
- Next
- End Sub
- Private Sub Form_Load()
- Me.Text2 = CONNSTR
- End Sub
复制代码
远程连接数:62个
本地TCP/IP连接数:3960个
本地Share Memory 连接数:14771个(受内存限制)
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|