hibernate tomcat
In this section, you will learn about Hibernate datasource configuration in Tomcat.
For Hibernate datasource configuration in Tomcat, you will need to take care the following things :
- There will be no change in your hibernate.cfg.xml file.
- Also the will be no change in web.xml and your <resource-ref> will be same as previous :
<resource-ref> <description>My DataSource</description> <res-ref-name>jdbc/primaryDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
<Resource name="jdbc/primaryDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="yourusername" password="yourpassword" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/yourdatabase"/>