I am one newbie at Java web. I am developing an application with Java web by using Hibernate and MySQL. The problem is when I try to log in sometimes it throws Communication link failure exception if I try to connect remote database. What may cause this problem? (I also changed time out value again it throws exception.)
Hibernate version : 4.3.3.Final
Glassfish Server : 4.1
Related error ss : http://hackengine-er.com/exceptions/link-failure.png
Project Source Codes : https://github.com/Muslum10cel/Vaccine
my 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>
Thanks for your help
As a first step, i would suggest changing a few configurations:
org.hibernate.dialect.MySQL5Dialect
instead of org.hibernate.dialect.MySQLDialect
com.mysql.cj.jdbc.Driver
instead of com.mysql.jdbc.Driver
?autoReconnect=true
org.hibernate.dialect.MySQL5Dialect
<property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/vaccine</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root_password_missing</property>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.