Tôi đang cố đặt autoReconnect = true mysql connection property trong tệp application.conf của ứng dụng Play Framework 2.0 của tôi. Nhưng nó đem lại cho tôi những lỗi sau:Cách đặt thuộc tính autoReconnect cho url db mysql trong tệp cấu hình Play Framework?
Caused by: java.sql.SQLException: The connection property 'autoReconnect' only accepts values of the form: 'true', 'false', 'yes' or 'no'. The value 'true?useUnicode=yes' is not in this set.
Đây là chuỗi kết nối của tôi trong application.conf file:
db.default.url="mysql://db_user:[email protected]/mydb?autoReconnect=true"
Tôi cố gắng để thiết lập thông số kết nối này bởi vì tôi nhận được lỗi này trong tôi ứng dụng sau khi nó được nhàn rỗi trong một thời gian dài:
[error] c.j.b.ConnectionHandle - Database access problem. Killing off all remaining connections in the connection pool. SQL State = 08S01
[error] application - Failed to login the user : guest
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully
received from the server was 153,398,761 milliseconds ago.
The last packet sent successfully to the server was 153,398,762 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.
tôi cũng cố gắng thiết lập các thông số này chơi db để khắc phục vấn đề kết nối này như đã đề cập ở đây (https://groups.google.com/forum/#!topic/play-framework/KzvbZ61j9Eo) nhưng nó không giải quyết được vấn đề.
idleConnectionTestPeriod=10
testConnectionOnCheckin=true
Mọi hướng dẫn để giải quyết vấn đề này sẽ được đánh giá cao.
Cảm ơn.
tác phẩm này có hoạt động không? Tôi đã thêm? AutoReconnect = true vào url jdbc nhưng khi tôi chờ quá lâu nó stil bị lỗi tương tự, nó không kết nối lại tự động – Gavriel