Good, my problem is that I need to connect to the database that I have on a server. The server I have from "Hostinger", it's free but for the capacity it gives it's only for a few things like a BDD.
The thing is that I'm programming with that bdd in eclipse (java language) and I'm using hibernate for views, code and so on. For now I'm doing well because I have the bdd in local but now that I upload it I want to connect to see if it goes.
I use this code for the connection in Hibernate:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">
root</property> //contraseña
<property name="hibernate.connection.url">
jdbc:mysql://localhost/comunidad</property> //nombre bdd
<property name="hibernate.connection.username"> //usuario
root</property>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQL5Dialect</property>
<mapping class="es.sdos.bean.Paciente"/>
<mapping class="es.sdos.bean.Usuario"/>
<mapping class="es.sdos.bean.Actividad"/>
</session-factory>
There I am specifying the version of msql, usu, pass, name bdd, that data is from the local bdd.
Now these are the data that the bdd of the server gives me:
It would look like this with that data:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">
u137181788_altair</property> //cambie la contraseña(altair)
<property name="hibernate.connection.url">
jdbc:mysql://mysql.hostinger.es/u137181788_bdd</property> //nombre bdd
<property name="hibernate.connection.username"> //usuario
u137181788_root</property>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQL5Dialect</property>
<mapping class="es.sdos.bean.Paciente"/>
<mapping class="es.sdos.bean.Usuario"/>
<mapping class="es.sdos.bean.Actividad"/>
</session-factory>
Just change the name of the bdd from "community" to "bdd" and the password from "root" to "altair". Try the code that is postponed and without the: "u137181788_" root