MySQL
MySQL
To use a MySQL database called "hibernate" on a server "dbhost" with username "uname" and password "pword" follow the instructions below
- Log in to MySQL as the root user: type mysql -u root -p at the shell prompt.
- Enter the mysql root user's password when prompted.
- Enter the following commands at the MySQL prompt:
create database hibernate; grant all privileges on hibernate to uname@'localhost' identified by 'pword'; grant all privileges on hibernate to uname@'%' identified by 'pword'; grant all privileges on hibernate.* to uname@'localhost' identified by 'pword'; grant all privileges on hibernate.* to uname@'%' identified by 'pword'; flush privileges;
To use this database you need to edit the hibernate.propeties file located in the service's configuration directory. First you must comment out any lines that refer to HypersonicSQL and uncomment the lines that refer to MySQL.
Now edit the file as shown below (make sure to replace "dbhost" with the actual name of the host where the database is located and "uname" and "pword" with the real username and password).
hibernate.dialect org.hibernate.dialect.MySQLDialect hibernate.connection.driver_class com.mysql.jdbc.Driver hibernate.connection.url jdbc:mysql://dbhost/hibernate hibernate.connection.username uname hibernate.connection.password pwordYou must also obtain the JDBC Connector JAR file and place this in your Tomcat /common/lib directory. The recommended download at the time of writing is Connector J/3.1
For further information consult the Hibernate and MySQL documentation.