If there is no special statement,% Tomcat-Home% represents the Tomcat installation directory. % Mysql% represents the MySQL installation directory. 1) Related platform Tomcat5.5.4 mysql5.0 jdk1.52) The relevant installation will not say much. It will be described in the directory of mysql-connector-java-3.0.16-ga-bin.jar in {% Tomcat-Home% / Common / lib} in the directory in the directory in which mysql-connector-java-3.0.16-ga is bin.jar is the official JDBC Driver of MySQL.
Came in the% mysql% / bin directory in the cmd command (for installing MySQL in this machine, if you can't enter the database because you set your password: This time you can use mysql -uroot without a password can be entered) Create a database: HibernateCreate Database Hibernate; Use Hibernate; Create Table Cat (CAT_ID VARCHAR (20) Not Null Primary Key, Name VARCHAR (20) Not Null, SEX Char (1), Weight Float; Insert Cat Values ('1', 'Hibernate " , 'F', 5); INSERT CAT VALUES ('2', 'Test', 'F', 10); User {Hibernate} PWD {Hibernate} grant all privileges on *. * To hibernate @ {hibernate} Localhost Identified by 'Hibernate' with Grant Option (this is the User) 3) Find% Tomcat-Home% Conf / Server.xml Add (specifically refer to DBCP configuration in Tomcat document)
! - driverClassName: Class name for the old mm.mysql JDBC driver is org.gjt.mm.mysql.Driver - we recommend using Connector / J though Class name for the official MySQL Connector / J driver is com.mysql.jdbc. .!. .Driver -> <- url: The JDBC connection url for connecting to your MySQL dB The autoReconnect = true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection mysqld. By Default Closes Idle Connections After 8 Hours. ->