我遇到了麻烦,我不知道为什么我无法连接到数据库,一切都还好。
IF(LEN(MID(A1;FIND("/";A1)+1;FIND("/";A1;FIND("/";A1)+1)−FIND("/";A1)−1))=1;"0"&MID(A1;FIND("/";A1)+1;FIND("/";A1;FIND("/";A1)+1)−FIND("/";A1)−1);MID(A1;FIND("/";A1)+1;FIND("/";A1;FIND("/";A1)+1)−FIND("/";A1)−1))
我的application.conf
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[SQLTimeoutException: Timeout after 60001ms of waiting for a connection.]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:293)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:220)
at play.api.GlobalSettings$class.onError(GlobalSettings.scala:160)
at play.api.DefaultGlobal$.onError(GlobalSettings.scala:188)
at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:346)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:345)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
Caused by: java.sql.SQLTimeoutException: Timeout after 60001ms of waiting for a connection.
at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:227)
at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:182)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:93)
at slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:12)
at slick.jdbc.JdbcBackend$BaseSession.conn$lzycompute(JdbcBackend.scala:415)
at slick.jdbc.JdbcBackend$BaseSession.conn(JdbcBackend.scala:414)
at slick.jdbc.JdbcBackend$SessionDef$class.prepareStatement(JdbcBackend.scala:297)
at slick.jdbc.JdbcBackend$BaseSession.prepareStatement(JdbcBackend.scala:407)
at slick.jdbc.StatementInvoker.results(StatementInvoker.scala:33)
at slick.jdbc.StatementInvoker.iteratorTo(StatementInvoker.scala:22)
Caused by: java.sql.SQLException: JDBC4 Connection.isValid() method not supported, connection test query must be configured
at com.zaxxer.hikari.pool.BaseHikariPool.addConnection(BaseHikariPool.java:441)
at com.zaxxer.hikari.pool.BaseHikariPool$1.run(BaseHikariPool.java:413)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 3 common frames omitted
build.sbt
slick.dbs.default.db.connectionTimeout=60000
slick.dbs.default.driver="utils.db.TetraoPostgresDriver$"
slick.dbs.default.db.driver="org.postgresql.Driver"
slick.dbs.default.db.url="jdbc:postgresql://localhost:5432 /templatesite_db"
slick.dbs.default.db.user="marcus"
slick.dbs.default.db.password="123"
play.http.parser.maxDiskBuffer=100MB
parsers.anyContent.maxLength=100MB
答案 0 :(得分:0)
我认为可能是HikariCP模块正在寻找connectionTestQuery而没有找到它(并抛出错误)。尝试将以下内容添加到application.conf:
slick.dbs.default.db.connectionTestQuery="/*ping*/ select 1" // or whatever
回答:Caused by: java.sql.SQLException: JDBC4 Connection.isValid() method not supported