我们有这个对象,我们从中获取我们的 queryEvaluator
object MyDataSource {
val queryFactory = new SqlQueryFactory
val apachePoolingDatabaseFactory = new ApachePoolingDatabaseFactory(
"SELECT 1",
10,
10,
new Duration(1000),
new Duration(10),
true,
new Duration(30000))
val queryEvaluatorFactory = new StandardQueryEvaluatorFactory(apachePoolingDatabaseFactory, queryFactory)
val queryEvaluator = queryEvaluatorFactory(dbConfig.driverClassName, dbConfig.url, dbConfig.username, dbConfig.password)
}
我们没有明确关闭连接,假设它已被处理。我们的 MySQL 数据库上的连接似乎用完了。
我们正在使用以下依赖项
libraryDependencies += "com.twitter" % "querulous" % "1.2.0-generic"
libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.12"