gpt4 book ai didi

sql - 如果您在 ColdFusion 中有两个具有相同设置的不同数据源连接,它们是否共享同一个池?

转载 作者:行者123 更新时间:2023-12-04 22:30:51 24 4
gpt4 key购买 nike

我在 ColdFusion Administrator 中创建了 2 个不同的数据源连接(到 MS SQL Server 2008),除了连接的实际名称外,它们具有完全相同的设置。我的问题是这会创建两个不同的连接池还是共享一个?

最佳答案

他们会有不同的池。池是在数据源级别定义的,就 ColdFusion 而言,您有两个不同的数据源。为什么您会有两个具有完全相同设置的不同数据源?我想如果你想强制他们使用不同的连接池。不过我想不出原因。

我发现此页面记录了 how database connections are handled in ColdFusion .请注意,“维护数据库连接”设置是为每个数据源设置的。

这是与该页面的连接池相关的部分(以防它消失):

If the "Maintain Database Connections" is set for a data source, how does ColdFusion Server maintain the connection pool?

When "Maintain Database Connections" is set for a data source, ColdFusion keeps the connection open after its first connection to the database. It does not log out of the database after this first connection. You can change this setting according to the instructions in step d above. Another setting in the ColdFusion Administrator, called "Limit cached database connection inactive time to X minutes," closes a "maintained" database connection after X inactive minutes. This setting is server wide and determines when a "maintained" connection is finally closed. You can modify this setting by going to the "Caching" tab within the ColdFusion Administrator. The interface for modifying the "Limit cached database connection inactive time to X minutes" looks like the following:

enter image description here

If a request is using a data source connection that is already opened, and another request to the data source comes in, a new connection is established. Since only one request can use a connection at any time, the simultaneous request will open up a new connection because no idle cached connections are available. The connection pool can increase up to the setting for simultaneous connections limit which is set for each data source. This setting, called, "Limit Connections," is in the ColdFusion Administrator. Click on one of the data source tabs and then click on one of your data sources. Click on "CF Settings" and put a check next to "Limit Connections" and enter a number in the sentence, "Enable the limit of X simultaneous connections." Please note that if you do not set this under the data source setting, ColdFusion Server will use the server wide "Simultaneous Requests" setting.

At this point, there is a pool of two database connections that ColdFusion Server maintains. Each connection remains in the pool until either the "Connection Timeout" period is reached or exceeds the inactivity time. If neither of the first two options are implemented, the connections remain in the pool until ColdFusion is restarted.

The "Connection Timeout" setting closes the connection and eliminates it from the pool whether or not it has been active or inactive. If the process is active, it will not terminate the connection. You can change this setting by going to "CF Settings" for your data source in the ColdFusion Administrator. Note: Only the "Cached database connection inactive time" setting will end the connection and eliminate it from the pool if it hasn't been used. You can also use the "Connection Timeout" to override the"Cached database connection inactive" setting as it applies only to a single data source, not all data sources.

关于sql - 如果您在 ColdFusion 中有两个具有相同设置的不同数据源连接,它们是否共享同一个池?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17443752/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com