0
我是Java網站的新手。我正在使用Hibernate和MySQL開發一個使用Java web的應用程序。問題是,當我嘗試登錄時,如果嘗試連接遠程數據庫,它有時會引發通信鏈接失敗異常。什麼可能導致這個問題? (我也再次改變超時值會拋出異常。)Hibernate-MySQL連接
Hibernate的版本:4.3.3.Final
GlassFish服務器:4.1
相關錯誤SS:http://hackengine-er.com/exceptions/link-failure.png
項目源代碼: https://github.com/Muslum10cel/Vaccine
我的hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">{MySQLDialect}</property>
<property name="hibernate.connection.driver_class">{jdbcdriver}</property>
<property name="hibernate.connection.url">{connectionstring}</property>
<property name="hibernate.connection.username">{username}</property>
<property name="hibernate.connection.password">{password}</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.c3p0.timeout">0</property>
</session-factory>
<!-- Entity mappings -->
</hibernate-configuration>
感謝您的幫助
感謝您的答覆。對於帖子,我已經刪除了密碼。我將用這些配置進行測試。非常感謝 –