2016-04-18 5 views
0

私はPlay Framework 2.3でアプリケーションを使用しており、SQL Server(2008、2012および2014バージョン)に接続しています。構成は次のようになります。Play Frameworkで設定エラーが発生した後にautoReconnectを設定するにはどうすればよいですか?

db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver 
db.default.url="jdbc:sqlserver://192.168.100.101;databaseName=myDatabase;SelectMethod=direct;autoReconnect=true" 

これは、SQL Serverを起動する前に起動するアプリケーションを除いて、すべて機能します。その場合、プレーはエラーを生成します。

Configuration error[Cannot connect to database [default]] 

は、自動にプレイが新しい要求を到着したときに、そのエラーの後に、再接続して、私はそれをどのように行うことができますPlayFrameworkを設定することが可能ということ、ですか?

答えて

1

HikariCPはa property to do exactly what you wantがあります

initializationFailFast: This property controls whether the pool will "fail fast" if the pool cannot be seeded with initial connections successfully. If you want your application to start even when the database is down/unavailable, set this property to false. Default: true

あなたは、デフォルトのプール(BoneCP)を置き換えるためにplay-hikaricp moduleを使用して、上記で説明したようにHikariCP設定することができます。

関連する問題