「労働者が自分の仕事をうまくやりたいなら、まず自分の道具を研ぎ澄まさなければなりません。」 - 孔子、「論語。陸霊公」
表紙 > プログラミング > Spring Bootで424時間後に冬眠した状態でデータベース接続損失を防ぐ方法は?

Spring Bootで424時間後に冬眠した状態でデータベース接続損失を防ぐ方法は?

2025-03-22に投稿されました
ブラウズ:451

How to Prevent Database Connection Loss After 424 Hours in Spring Boot with Hibernate?

解決データベース接続損失は、hibernate

でspring bootで424時間後に424時間後にMySQLを使用したスプリングブートアプリケーションで発生します。エラーログが表示されます:

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 56,006,037 milliseconds ago.  The last packet sent successfully to the server was 56,006,037 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

これらの設定は、接続プールを次のようにします。 (spring.datasource.test-while-idle)。データベースの接続性が延長された後でも、非アクティブされた期間。

リリースステートメント この記事は、侵害がある場合は1729757864に再現されています。勉強[email protected]に連絡して削除してください。
最新のチュートリアル もっと>

免責事項: 提供されるすべてのリソースの一部はインターネットからのものです。お客様の著作権またはその他の権利および利益の侵害がある場合は、詳細な理由を説明し、著作権または権利および利益の証拠を提出して、電子メール [email protected] に送信してください。 できるだけ早く対応させていただきます。

Copyright© 2022 湘ICP备2022001581号-3