I am trying to connect to the database with hibernate using spring.
I am using IntelliJ IDEA.
I have created new spring project. Added hibernate framework to it and then :
View -> Tool Windows -> Persistance -> Right click on project -> Generate persistence mapping -> By database schema -> Choose data source ( added the database ) -> choosed package -> created hibernate.config.xml -> chosed entities to map -> ok
It has generated this hibernate.congif.xml file
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:mysql://localhost:3306/tornoci</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<mapping class="db.TorkoEntity"/>
<!-- DB schema will be updated if needed -->
<!-- <property name="hbm2ddl.auto">update</property> -->
</session-factory>
</hibernate-configuration>
Now when i right click on persistance and chose console i type
from TorkoEntity
and run it it throws
[28000] Access denied for user 'matej'@'localhost' (using password: NO)
I was going step by step with this source yet i cannot figure out why is this happening , i tried to add
<property name="hibernate.connection.username">name</property>
<property name="hibernate.connection.password">passwd</property>
to the hibernate.config.xml file but it didnt help at all.
How can i make this work? All help is highly appreciated. Thanks