简体   繁体   English

Wso2数据服务服务器超时数据库连接

[英]Wso2 Data Services Server timeout database connection

I have a problem in WSO2 DSS, the database connection timeout is occurring after a few hours, then I have to stopping and starting the DSS to work. 我在WSO2 DSS中遇到问题,几个小时后发生数据库连接超时,然后必须停止并启动DSS才能工作。

The DSS version is 2.5.1 DSS版本为2.5.1

the database server is sql server can help me ? 数据库服务器是sql server可以帮助我吗? Thank 谢谢

Have you properly configured your datasource that's used in the dataservice descriptor file to enable "validationQuery" parameter to "SELECT 1" (validation query can vary depending on the RDBMS type used but for SQL server you can use the aforementioned query) and "testOnBorrow" parameter to "true"? 您是否已正确配置数据服务描述符文件中使用的数据源,以将“ validationQuery”参数启用为“ SELECT 1”(验证查询会因所使用的RDBMS类型而异,但对于SQL Server,您可以使用上述查询)和“ testOnBorrow”参数设置为“ true”?

To give you a bit of context on the issue, any RDBMS type by default has a connection timeout value defined. 为了使您对此问题有一些了解,默认情况下,任何RDBMS类型都定义了连接超时值。 For example, MySQL has a default timeout of 8 hours by default. 例如,默认情况下,MySQL的默认超时为8小时。 When connection pooling is used in an application, the connections are kept in the pool once they are created without physically closing to reuse them. 在应用程序中使用连接池时,一旦创建了连接,连接将保留在池中,而无需物理关闭即可重用。 However, after the aforementioned period of time, the connections become stale and you have to validate the connections before using them. 但是,经过上述一段时间后,连接变得陈旧,您必须在使用连接之前验证连接。 This is done by specifying a validation query which will be executed whenever a pooled connection is reused. 这是通过指定一个验证查询来完成的,该查询将在池连接被重用时执行。 and the "testOnBorrow" parameter comes handy as, when specified, it will validate the pooled connections when they are borrowed from the conneciton pool. 并且“ testOnBorrow”参数派上用场了,因为如果指定了该参数,当从连接池中借用池化连接时,它将验证池化连接。

Cheers, Prabath 干杯,干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM