Question

I have a doubt that whether Pooling actually works with vb.net. I used below query to check the connection to the database from different pc.

SELECT hostname,p.status,[program_name],loginame,name
FROM Master..sysprocesses  as p join master.dbo.sysdatabases as  d on p.dbID = d.dbID
WHERE p.ecid=0 and p.hostname<>'' 
order by name

In the output i saw more than one connection from a pc to the same database.

So i got doubt about this.In my vb.net application i open connection only once so i was thinking like the connection will be used from same pool,so there will be only one open connection to a database from a PC.

UPDATE

I have a vb.net application which makes use of connection to SQL server databases.

  1. If i open a multiple instances of same program then connection will be drawn from same pool or different pool?

  2. If we open different exe but both open connection to same databases then same connection pool will be used by both?

When we run query in SQL server many connections are shown to same DB from same PC.

Was it helpful?

Solution

Pooling does not guarantee a single connection. For each concurrently active (logical) connection you need one physical connection. So if you have 10 threads each using a connection instance, or for some reason are opening 10 connections on a single thread, you will see 10 physical connections.

A single session is assigned to a single connection. Each connection can have at most one session at the same time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top