连接池问题 [英] Connection pooling question

查看:106
本文介绍了连接池问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS2003并连接到MS Access数据库。

使用连接池时(每次打开OLEDBCONNECTION时我使用

完全匹配的连接字符串) ,

1.我怎么知道已经使用了多少连接?

2.如果达到最大池大小,当我打电话给

方法打开以打开连接?我会收到错误吗? MSDN说

请求是排队的,但是我在open方法中会出错吗?


ConnectionDemoOLE =新的OleDb.OleDbConnection

sPath =" Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" &安培; sDBPath& " ;; OLE DB

服务= -1"

使用ConnectionDemoOLE

.ConnectionString = sPath

。打开() - 当最大泳池尺寸达到
时会发生什么?


谢谢

解决方案

我认为JET提供商没有公开任何系统计数器,或者OLE DB监控CP需要



如果你耗尽了游泳池你应该得到一个超时例外。

但是,(和金妮请在这里纠正我),如果你正在使用JET和

一个ASP应用程序,你的电线已经越过了。 JET的目的不是为
提供多个用户的数据。当然,您可以通过LAN共享JET .MDB数据库

,但每个用户都有自己的JET引擎来访问该文件。在需要一个JET引擎来访问数据的Web应用程序中使用

它最多是有问题的。我建议使用专为网络设计的DBMS - SQL

Express。


hth


- < br $>
William(Bill)Vaughn

作者,导师,顾问

Microsoft MVP

INETA演讲者
< a rel =nofollowhref =http://www.betav.com/blog/billvatarget =_ blank> www.betav.com/blog/billva
www.betav.com

请回复新闻组,以便其他人可以受益。

此帖子按原样提供。没有保证,也没有赋予任何权利。

__________________________________

访问 www.hitchhikerguides.net 获取有关我最新书籍的更多信息:

Hitchhiker的Visual Studio和SQL Server指南(第7版)和

Hitchhiker的SQL Server 2005精简版指南


------------------------ -------------------------------------------------- ---------------------------------------------

fniles < fn **** @ pfmail.com在留言中写道

新闻:ej ************** @ TK2MSFTNGP03.phx.gbl ...


>我正在使用VS2003并连接到MS Access数据库。

使用连接池时(每次打开OLEDBCONNECTION时我都会这样做) >
使用完全匹配的连接字符串),

1.我怎么知道已经使用了多少连接?

2.如果最大池大小有到达了,当我打电话给

方法打开连接时会发生什么?我会收到错误吗? MSDN说

请求是排队的,但是我在open方法中会出错吗?


ConnectionDemoOLE =新的OleDb.OleDbConnection

sPath =" Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" &安培; sDBPath& " ;; OLE

DB

服务= -1"

使用ConnectionDemoOLE

.ConnectionString = sPath

.Open() - 当最大泳池尺寸达到
时会发生什么?


谢谢



我在局域网上使用VB.Net 2003,我别无选择,只能使用MS

访问。

在SQL Server中,您可以在连接字符串中设置最大池大小,您可以在MS Access中执行此操作吗?


您提到如果您耗尽了游泳池,您应该暂停

例外。所以,你会得到一个错误,对吧?

我的意思是如果你把try-catch-end试试,它会去Cath部分,对吗?

在我的我发布的其他帖子,有时我得到未指定的错误在打开OleDBConnection时打开

Open方法。这不会发生所有时间,只是有时候,这让我觉得可能已达到最大游泳池价格?b $ b尺寸?是否有可能出现未指定的错误。在

已达到最大池大小引起的Open方法?


Dim swError As StreamWriter

Dim sSub As String

尝试

sSub =" 1"

ConnectionOLE =新OleDb.OleDbConnection

OpenDBOLE = True

使用ConnectionOLE

.ConnectionString = g_dbPath

sSub =" 2"

。打开() - if MAX游泳池大小已经到达,它将在下面的Catch部分获得


sSub =" 3"

结束时

Catch ex As Exception

swError = New StreamWriter(Application.StartupPath&

" \ AQErrorLog"& Date.Now.ToString(" ; MMddyy")&" .txt",True)

swError.Write(Now&OpenDBOLE - error ="& ex.Message&"

sub ="& sSub&" g_dbPath ="& g_dbPath& vbCrLf)

swError.Close()

swErr或者=没有什么

结束尝试


谢谢。


" William(Bill)Vaughn" < billva@NoSpamAtAll_betav.com在留言中写道

news:u2 **************** @ TK2MSFTNGP02.phx.gbl ...
< blockquote class =post_quotes>
>我不认为JET提供者公开任何系统计数器或OLE DB监视CP。

如果你耗尽了游泳池,你应该得到一个超时例外。

但是,(如果你正在使用JET

和ASP,那么(和金妮请在这里纠正我))应用程序,你有你的电线交叉。 JET没有设计

来为多个用户提供数据。当然,您可以通过LAN共享JET .MDB

数据库,但每个用户都有自己的JET引擎来访问

文件。在需要一个JET引擎访问

的Web应用程序中使用它,数据最多也是有问题的。我建议使用专为

网站设计的DBMS - SQL Express。


hth


- < br $>
William(Bill)Vaughn

作者,导师,顾问

Microsoft MVP

INETA演讲者
< a rel =nofollowhref =http://www.betav.com/blog/billvatarget =_ blank> www.betav.com/blog/billva
www.betav.com

请回复新闻组,以便其他人可以受益。

此帖子按原样提供。没有保证,并且不授予

权利。

__________________________________

访问 www.hitchhikerguides.net 获取有关我最新书籍的更多信息:

Hitchhiker的Visual Studio和SQL Server指南(第7版)版本)和

Hitchhiker的SQL Server 2005精简版指南


---------------- -------------------------------------------------- -------------------------------------------------- ---

" fniles" < fn **** @ pfmail.com在留言中写道

新闻:ej ************** @ TK2MSFTNGP03.phx.gbl ...


>>我正在使用VS2003并连接到MS Access数据库。
使用连接池时(每次打开OLEDBCONNECTION时我都会使用)完全匹配的连接字符串),
1。我如何知道已使用了多少连接?
2。如果已达到最大池大小,当我调用
方法打开连接时会发生什么?我会收到错误吗? MSDN说请求排队,但是我会在open方法中出错吗?

ConnectionDemoOLE =新的OleDb.OleDbConnection
sPath =" Provider = Microsoft.Jet。 OLEDB.4.0;数据源= &安培; sDBPath& " ;; OLE
DB
Services = -1"
使用ConnectionDemoOLE
.ConnectionString = sPath
。打开() - 这里最大池大小时会发生什么已经达到了吗?

谢谢




< blockquote>参见>>>>>


-

William(Bill)Vaughn

作者,导师,顾问

Microsoft MVP

INETA演讲者
www.betav.com/blog/billva
www.betav.com

请仅回复新闻组,以便其他人可以受益。

此帖子按原样提供。没有保证,也没有赋予任何权利。

__________________________________

访问 www.hitchhikerguides.net 获取有关我最新书籍的更多信息:

Hitchhiker的Visual Studio和SQL Server指南(第7版)和

Hitchhiker的SQL Server 2005精简版指南


------------------------ -------------------------------------------------- ---------------------------------------------

fniles < fn **** @ pfmail.com在留言中写道

新闻:%2 **************** @ TK2MSFTNGP03.phx.gbl ...


>我在局域网上使用VB.Net 2003,我别无选择,只能使用MS
访问。

在SQL Server中,您可以在连接字符串中设置最大池大小,您可以在MS Access中执行此操作吗?


>>>> Nope。


>

你提到如果你耗尽了游泳池你应该获得暂停

例外。所以,你会得到一个错误,对吧?

我的意思是如果你把try-catch-end试试,它会去Cath部分,对吧



>>>>对。


在我发布的其他帖子中,有时我得到未指定的错误

打开OleDBConnection时的Open方法。这不会发生

,只是有时候,这让我觉得可能已达到最大的
池大小?是否可能由于最大池大小而导致Open方法出现未指定错误



>>>" Unspecified"错误通常意味着你没有Try / Catch块来捕获特定的异常。在Access / JET中,是的,它可能意味着
池已满或数据库已损坏,或几乎任何其他内容。


>

Dim swError As StreamWriter

Dim sSub As String

尝试

sSub =" 1"

ConnectionOLE =新OleDb.OleDbConnection

OpenDBOLE = True

使用ConnectionOLE

.ConnectionString = g_dbPath

sSub =" 2"

。打开() - 已经达到了最大泳池尺寸,它将在下面的Catch部分获得


>>理论上......是的。


sSub =" 3"

结束

Catch ex As Exception

swError = New StreamWriter(Application.StartupPath&

" \ AQErrorLog"& Date.Now.ToString(" MMddyy" )&" .txt",True)

swError.Write(Now&OpenDBOLE - error ="& ex.Message&

" ; sub ="& sSub&" g_dbPath ="& g_dbPath& vbCrLf)

swError.Close()

swError = Nothing

结束尝试


谢谢。


" William(Bill)Vaughn" < billva@NoSpamAtAll_betav.com在留言中写道

news:u2 **************** @ TK2MSFTNGP02.phx.gbl ...
< blockquote class =post_quotes>
>>我认为没有任何系统计数器由JET提供程序公开或由OLE DB监视CP。
如果你耗尽游泳池你应该得到一个超时例外。
然而,(和金妮请在这里纠正我),如果你正在使用JET
和一个ASP应用程序,你的电线已经越过。 JET不是为多个用户提供数据而设计的。当然,您可以通过LAN共享一个JET .MDB数据库,但每个用户都有自己的JET引擎来访问该文件。在需要一个JET
引擎访问数据的Web应用程序中使用它充其量是个问题。我建议使用专为网络设计的DBMS - SQL Express。



-
William(Bill)Vaughn
作者,导师,顾问
微软MVP
INETA演讲者
www.betav.com/blog/billva
www.betav.com
请仅回复新闻组,以便其他人可以受益。
此帖子按原样提供。没有保证,也没有授予
权利。
__________________________________
访问 www .hitchhikerguides.net 获取有关我最新的书籍的更多信息:
Hitchhiker的Visual Studio和SQL Server指南(第7版)和
Hitchhiker's Guide到SQL Server 2005精简版

------------------------------------ -------------------------------------------------- ---------------------------------
" fniles" < fn **** @ pfmail.com在留言中写道
新闻:ej ************** @ TK2MSFTNGP03.phx.gbl ...


>>>我正在使用VS2003并连接到MS Access数据库。
使用连接池时(每次打开OLEDBCONNECTION时我都会使用确切的匹配连接字符串),
1。我如何知道已使用了多少连接?
2。如果已达到最大池大小,当我调用
方法打开连接时会发生什么?我会收到错误吗? MSDN说请求排队,但是我会在open方法中出错吗?

ConnectionDemoOLE =新的OleDb.OleDbConnection
sPath =" Provider = Microsoft.Jet。 OLEDB.4.0;数据源= &安培; sDBPath&
" ;; OLE DB
Services = -1"
使用ConnectionDemoOLE
.ConnectionString = sPath
。打开() - 这里发生什么已达到最大泳池尺寸?







I am using VS2003 and connecting to MS Access database.
When using a connection pooling (every time I open the OLEDBCONNECTION I use
the exact matching connection string),
1. how can I know how many connection has been used ?
2. If the maximum pool size has been reached, what happens when I call the
method Open to open the connection ? Will I get an error ? MSDN says the
request is queued, but will I get an error in the open method ?

ConnectionDemoOLE = New OleDb.OleDbConnection
sPath = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sDBPath & ";OLE DB
Services=-1"
With ConnectionDemoOLE
.ConnectionString = sPath
.Open() --what happens here when the maximum pool size has been
reached ?

Thanks

解决方案

I don''t think there are any system counters exposed by the JET provider or
by OLE DB to monitor the CP.
If you exhaust the pool you should get a timeout exception.
However, (and Ginny please correct me here), if you''re working with JET and
an ASP application, you''ve got your wires crossed. JET is not designed to
provide data for more than one user. Sure, you can share a JET .MDB database
over a LAN, but each user gets its own JET engine to access the file. Using
it in a web application that requires one JET engine to access the data is
problematic at best. I suggest using a DBMS designed for the web--SQL
Express.

hth

--
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest books:
Hitchhiker''s Guide to Visual Studio and SQL Server (7th Edition) and
Hitchhiker''s Guide to SQL Server 2005 Compact Edition

-----------------------------------------------------------------------------------------------------------------------
"fniles" <fn****@pfmail.comwrote in message
news:ej**************@TK2MSFTNGP03.phx.gbl...

>I am using VS2003 and connecting to MS Access database.
When using a connection pooling (every time I open the OLEDBCONNECTION I
use the exact matching connection string),
1. how can I know how many connection has been used ?
2. If the maximum pool size has been reached, what happens when I call the
method Open to open the connection ? Will I get an error ? MSDN says the
request is queued, but will I get an error in the open method ?

ConnectionDemoOLE = New OleDb.OleDbConnection
sPath = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sDBPath & ";OLE
DB
Services=-1"
With ConnectionDemoOLE
.ConnectionString = sPath
.Open() --what happens here when the maximum pool size has been
reached ?

Thanks



I am using VB.Net 2003 over a LAN, and I have no choice but to use MS
Access.
In SQL Server, in the connection string you can set the max pool size, can
you do that in MS Access ?

You mentioned that "If you exhaust the pool you should get a timeout
exception." So, you will get an error, right ?
I mean if you put try-catch-end try, it will go to the Cath section, right ?
In my other posting I posted that sometimes I get "Unspecified error" on the
Open method when opening up the OleDBConnection. This does not happen all
the time, only sometimes, which makes me think that maybe the maximum pool
size has been reached ? Is it possible that the "Unspecified error" on the
Open method caused by the maximum pool size has been reached ?

Dim swError As StreamWriter
Dim sSub As String
Try
sSub = "1"
ConnectionOLE = New OleDb.OleDbConnection
OpenDBOLE = True
With ConnectionOLE
.ConnectionString = g_dbPath
sSub = "2"
.Open() --IF MAX POOL SIZE HAS BEEN REACHED, IT WILL GO
TO THE Catch section below ?
sSub = "3"
End With
Catch ex As Exception
swError = New StreamWriter(Application.StartupPath &
"\AQErrorLog" & Date.Now.ToString("MMddyy") & ".txt", True)
swError.Write(Now & " OpenDBOLE - error = " & ex.Message & "
sub = " & sSub & " g_dbPath = " & g_dbPath & vbCrLf)
swError.Close()
swError = Nothing
End Try

Thank you.

"William (Bill) Vaughn" <billva@NoSpamAtAll_betav.comwrote in message
news:u2****************@TK2MSFTNGP02.phx.gbl...

>I don''t think there are any system counters exposed by the JET provider or
by OLE DB to monitor the CP.
If you exhaust the pool you should get a timeout exception.
However, (and Ginny please correct me here), if you''re working with JET
and an ASP application, you''ve got your wires crossed. JET is not designed
to provide data for more than one user. Sure, you can share a JET .MDB
database over a LAN, but each user gets its own JET engine to access the
file. Using it in a web application that requires one JET engine to access
the data is problematic at best. I suggest using a DBMS designed for the
web--SQL Express.

hth

--
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest books:
Hitchhiker''s Guide to Visual Studio and SQL Server (7th Edition) and
Hitchhiker''s Guide to SQL Server 2005 Compact Edition

-----------------------------------------------------------------------------------------------------------------------
"fniles" <fn****@pfmail.comwrote in message
news:ej**************@TK2MSFTNGP03.phx.gbl...

>>I am using VS2003 and connecting to MS Access database.
When using a connection pooling (every time I open the OLEDBCONNECTION I
use the exact matching connection string),
1. how can I know how many connection has been used ?
2. If the maximum pool size has been reached, what happens when I call
the method Open to open the connection ? Will I get an error ? MSDN says
the request is queued, but will I get an error in the open method ?

ConnectionDemoOLE = New OleDb.OleDbConnection
sPath = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sDBPath & ";OLE
DB
Services=-1"
With ConnectionDemoOLE
.ConnectionString = sPath
.Open() --what happens here when the maximum pool size has been
reached ?

Thanks




See >>>>>

--
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest books:
Hitchhiker''s Guide to Visual Studio and SQL Server (7th Edition) and
Hitchhiker''s Guide to SQL Server 2005 Compact Edition

-----------------------------------------------------------------------------------------------------------------------
"fniles" <fn****@pfmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...

>I am using VB.Net 2003 over a LAN, and I have no choice but to use MS
Access.
In SQL Server, in the connection string you can set the max pool size, can
you do that in MS Access ?

>>>>Nope.

>
You mentioned that "If you exhaust the pool you should get a timeout
exception." So, you will get an error, right ?
I mean if you put try-catch-end try, it will go to the Cath section, right
?

>>>>Right.

In my other posting I posted that sometimes I get "Unspecified error" on
the Open method when opening up the OleDBConnection. This does not happen
all the time, only sometimes, which makes me think that maybe the maximum
pool size has been reached ? Is it possible that the "Unspecified error"
on the Open method caused by the maximum pool size has been reached ?

>>>"Unspecified" errors generally means you don''t have a Try/Catch block
to trap the specific exception. In Access/JET, yes it might mean the
pool is full or the database is corrupt, or almost anything else.

>
Dim swError As StreamWriter
Dim sSub As String
Try
sSub = "1"
ConnectionOLE = New OleDb.OleDbConnection
OpenDBOLE = True
With ConnectionOLE
.ConnectionString = g_dbPath
sSub = "2"
.Open() --IF MAX POOL SIZE HAS BEEN REACHED, IT WILL GO
TO THE Catch section below ?

>>In theory... yes.

sSub = "3"
End With
Catch ex As Exception
swError = New StreamWriter(Application.StartupPath &
"\AQErrorLog" & Date.Now.ToString("MMddyy") & ".txt", True)
swError.Write(Now & " OpenDBOLE - error = " & ex.Message &
" sub = " & sSub & " g_dbPath = " & g_dbPath & vbCrLf)
swError.Close()
swError = Nothing
End Try

Thank you.

"William (Bill) Vaughn" <billva@NoSpamAtAll_betav.comwrote in message
news:u2****************@TK2MSFTNGP02.phx.gbl...

>>I don''t think there are any system counters exposed by the JET provider or
by OLE DB to monitor the CP.
If you exhaust the pool you should get a timeout exception.
However, (and Ginny please correct me here), if you''re working with JET
and an ASP application, you''ve got your wires crossed. JET is not
designed to provide data for more than one user. Sure, you can share a
JET .MDB database over a LAN, but each user gets its own JET engine to
access the file. Using it in a web application that requires one JET
engine to access the data is problematic at best. I suggest using a DBMS
designed for the web--SQL Express.

hth

--
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest
books:
Hitchhiker''s Guide to Visual Studio and SQL Server (7th Edition) and
Hitchhiker''s Guide to SQL Server 2005 Compact Edition

-----------------------------------------------------------------------------------------------------------------------
"fniles" <fn****@pfmail.comwrote in message
news:ej**************@TK2MSFTNGP03.phx.gbl...

>>>I am using VS2003 and connecting to MS Access database.
When using a connection pooling (every time I open the OLEDBCONNECTION I
use the exact matching connection string),
1. how can I know how many connection has been used ?
2. If the maximum pool size has been reached, what happens when I call
the method Open to open the connection ? Will I get an error ? MSDN says
the request is queued, but will I get an error in the open method ?

ConnectionDemoOLE = New OleDb.OleDbConnection
sPath = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sDBPath &
";OLE DB
Services=-1"
With ConnectionDemoOLE
.ConnectionString = sPath
.Open() --what happens here when the maximum pool size has been
reached ?

Thanks





这篇关于连接池问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆