TADOConnection.Close - connection still active on MS-SQL server

I have several Delphi programs (XE3), that use a TADOConnection to connect to a MS-SQL Server. I recently checked the connections in the "MS SQL Server Management Studio"'s process list.

  • When the program starts, the connection is inactive, no connection in the server's process list.
  • When I open the connection it's shown in the process list - as expected.
  • When I close the connection (definitely the property "Connected" returns FALSE), the connection is still shown on the servers process list.

On the server the Connection is not closed until I close the program.

Is there a way to close the TADOConnection in a way that really removes the connection on the server without exiting the program?


This is connection pooling; and is a good thing.

But if you really want to hurt performance, you can opt-out of connection pooling features by adding the request to your connection string:

Provider=SQLOLEDB;Data Source=myServerAddress;Initial Catalog=myDataBase;
User ID=myUsername;Password=correct horse battery stapler;OLE DB Services=-2;

These OLE DB Services options are documented on MSDN:

Pooling in the Microsoft Data Access Components (archive)

OLE DB Services  Services enabled
===============  ==================================================
-1               All services (the default)
-2               All services except pooling
-4               All services except pooling and auto-enlistment
-5               All services except client cursor
-6               All services except client cursor and pooling
 0               No services

 

来源:https://stackoverflow.com/questions/48705373/tadoconnection-close-connection-still-active-on-ms-sql-server

 

转载于:https://www.cnblogs.com/railgunman/p/9489646.html

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值