Home > database >  Please comment PB11 connect to the database problem. Ado.net/oledb
Please comment PB11 connect to the database problem. Ado.net/oledb

Time:09-27

I write a simple program to use ado.net to connect to the database connection, when open the five procedures, database shows that there are five links.
If pb11 write a webservice, inside the connection code is ado.net, client calls this interface. If I open the client, 20 cycle constantly call interface, database connection number has been showed a connection.
I would like to ask the question is, ado.net connection will automatically manage database connection pool? If can, why C/S direct application, open a few programs will have a few connection??
Why designed webservice it without every connection to generate a link??

CodePudding user response:

Keep an eye on

CodePudding user response:

Ha ha, ado.net will automatically manage the connection pool;
C/S, every program that you are real and backend database connection, of course, there are several client will have a few connection;
In cases where the webservice, front end do not in direct connection with the database, the real and the database connection is IIS, and your code should handle the webservice will connect before using the database, after use will disconnect, under normal circumstances, of course, there will be only one connection, even if you didn't disconnect, also ado.net decision several specific connection, but in view of the object are IIS ~ ~

CodePudding user response:

refer to the original poster lingdove response:
I write a simple program to use ado.net to connect to the database connection, when open the five procedures, database shows that there are 5 connection.
If pb11 write a webservice, inside the connection code is ado.net, client calls this interface. If I open the client, 20 cycle constantly call interface, database connection number has been showed a connection.
I would like to ask the question is, ado.net connection will automatically manage database connection pool? If can, why C/S direct application, open a few programs will have a few...


If the C/S structure, database connection for long connection, will open a program, more than a connection

Webservice is short connection, call connection is broken, even if you don't disconnect, webservice also severed the connection for you, so will only display the connection,

CodePudding user response:

Personal understanding: the ws should not be seen as short connection, because in the survival period of ws, connections are not allowed to disconnect, this and c/s no different; It's like a c/s program exit immediately after connecting to the database, even though it was short operation time, must still be considered long connection,

Ado.net is Microsoft's, so can be iis connection pool managed automatically, even from the configuration,
  • Related