Guest User

Untitled

a guest
Sep 7th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. Hibernate JDBCExceptionReporter -> Connection validity, timeout, auto reconnect
  2. <hibernate-configuration>
  3. <session-factory>
  4. <!-- Database connection settings -->
  5. <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  6. <property name="connection.url">jdbc:mysql://localhost/mydbtest</property>
  7. <property name="connection.username">root</property>
  8. <property name="connection.password">mypassword</property>
  9. <!-- JDBC connection pool (use the built-in) -->
  10. <property name="connection.pool_size">20</property>
  11. <!-- SQL dialect -->
  12. <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
  13. <!-- Enable Hibernate's automatic session context management, in this case
  14. the session will be close after each transaction! -->
  15. <property name="current_session_context_class">thread</property>
  16. <!-- Disable the second-level cache -->
  17. <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
  18. <!-- Echo all executed SQL to stdout -->
  19. <property name="show_sql">true</property>
  20. <!-- auto create tables -->
  21. <property name="hbm2ddl.auto">none</property>
  22. ...
  23. </session-factory>
  24. </hibernate-configuration>
  25.  
  26. Hibernate: select ...
  27. WARN : org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 08S01
  28. ERROR: org.hibernate.util.JDBCExceptionReporter -
  29. The last packet successfully received from the server was 61.428.729
  30. milliseconds ago. The last packet sent successfully to the server was
  31. 61.428. milliseconds ago. is longer than the server configured value of
  32. 'wait_timeout'. You should consider either expiring and/or testing
  33. connection validity before use in your application, increasing the server
  34. configured values for client timeouts, or using the Connector/J
  35. connection property 'autoReconnect=true' to avoid this problem.
  36.  
  37. <property name=“hibernate.c3p0.acquire_increment”>3</property>
  38. <property name=“hibernate.c3p0.idle_test_period”>14400</property>
  39. <property name=“hibernate.c3p0.timeout”>25200</property>
  40. <property name=“hibernate.c3p0.max_size”>15</property>
  41. <property name=“hibernate.c3p0.min_size”>3</property>
  42. <property name=“hibernate.c3p0.max_statements”>0</property>
  43. <property name=“hibernate.c3p0.preferredTestQuery”>select 1;</property>
  44.  
  45. [mysqld]
  46. datadir=/var/lib/mysql
  47. socket=/var/lib/mysql/mysql.sock
  48. user=mysql
  49. # Disabling symbolic-links is recommended to prevent assorted security risks
  50. symbolic-links=0
  51.  
  52. [mysqld_safe]
  53. log-error=/var/log/mysqld.log
  54. pid-file=/var/run/mysqld/mysqld.pid
Add Comment
Please, Sign In to add comment