Combining .NET ODBC Connections

I open the connection as follows:

Using conn as New OdbcConnection(connectionString)
    conn.Open()
    //do stuff
End Using

If the connection pool is enabled, the connection is not physically closed, but freed into the pool and will be reused. If it is disabled, it will be physically closed.

Is there a way to find out programmatically if the connection pool is enabled or not? and the number of used and unused connections open in the pool?

EDIT: I need to get this information from the program, I can’t go and check it manually on each PC where the program will be deployed.

+3
source share
3 answers

Looks like you can just read this registry key:

[HKEYLOCALMACHINE] \ SOFTWARE \ ODBC \ ODBCINST.INI \ SQL Server \ CPTimeout

( , ). 0, . 0, .

:

http://msdn.microsoft.com/en-us/library/ms810829.aspx

. : ?

+1

MSDN

[]

, ODBC . "", "", Odbcad32.

ODBC " " ODBC 3.5 .

3.5 ODBC, CPTimeout.

. , .NET (, SqlConnection SQL Server - , ).

Update

Vista "ODBC" "", .

OP

, , MSDN. , , (. ).

TBH, , , , , . AFAIK , ( ) . , .

+2

To determine the number of open connections on each db, try this sql - I got it from a document on the Internet

select  db_name(dbid) , count(*) 'connections count'
  from master..sysprocesses
 where spid > 50 and spid  @@spid
 group by  db_name(dbid)
 order by count(*) desc

Spids <= 50 are used by sqlserver. So the above sql will tell you the connection used by your programs.

0
source

Source: https://habr.com/ru/post/1697434/


All Articles