我们有这个对象,我们从中获取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"