mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-16 04:35:49 +00:00
SPR-6447
+ improve DataSource setup
This commit is contained in:
parent
c9c939de2a
commit
19173a063e
2 changed files with 72 additions and 0 deletions
24
src/main/resources/db/mysql/petclinic_db_setup_mysql.txt
Normal file
24
src/main/resources/db/mysql/petclinic_db_setup_mysql.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
================================================================================
|
||||||
|
=== Spring PetClinic sample application - MySQL Configuration ===
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
@author Sam Brannen
|
||||||
|
@author Costin Leau
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1) Download and install the MySQL database (e.g., MySQL Community Server 5.1.x),
|
||||||
|
which can be found here: http://dev.mysql.com/downloads/
|
||||||
|
|
||||||
|
2) Download Connector/J, the MySQL JDBC driver (e.g., Connector/J 5.1.x), which
|
||||||
|
can be found here: http://dev.mysql.com/downloads/connector/j/
|
||||||
|
Copy the Connector/J JAR file (e.g., mysql-connector-java-5.1.5-bin.jar) into
|
||||||
|
the db/mysql directory. Alternatively, uncomment the mysql-connector from the
|
||||||
|
Petclinic pom.
|
||||||
|
|
||||||
|
3) Create the PetClinic database and user by executing the "db/mysql/createDB.txt"
|
||||||
|
script.
|
||||||
|
|
||||||
|
4) Open "src/main/resources/jdbc.properties"; comment out all properties in the
|
||||||
|
"HSQL Settings" section; uncomment all properties in the "MySQL Settings"
|
||||||
|
section.
|
|
@ -3,6 +3,54 @@
|
||||||
<Context path="/petclinic" docBase="petclinic" debug="4" reloadable="true">
|
<Context path="/petclinic" docBase="petclinic" debug="4" reloadable="true">
|
||||||
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_petclinic_log." suffix=".txt" timestamp="true"/>
|
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_petclinic_log." suffix=".txt" timestamp="true"/>
|
||||||
|
|
||||||
|
<!-- Define a database connection pool for HSQL -->
|
||||||
|
<!-- NOTE: make sure that a copy of hsqldb.jar is in the TOMCAT common/lib directory -->
|
||||||
|
<Resource name="jdbc/petclinicHSQL" auth="Container" type="javax.sql.DataSource"/>
|
||||||
|
<ResourceParams name="jdbc/petclinicHSQL">
|
||||||
|
<parameter>
|
||||||
|
<name>factory</name>
|
||||||
|
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
<parameter>
|
||||||
|
<name>driverClassName</name>
|
||||||
|
<value>org.hsqldb.jdbcDriver</value>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>url</name>
|
||||||
|
<value>jdbc:hsqldb:hsql://localhost:9001</value>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>username</name>
|
||||||
|
<value>sa</value>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
<parameter>
|
||||||
|
<name>maxActive</name>
|
||||||
|
<value>50</value>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>maxIdle</name>
|
||||||
|
<value>10</value>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>maxWait</name>
|
||||||
|
<value>10000</value>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>removeAbandoned</name>
|
||||||
|
<value>true</value>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>removeAbandonedTimeout</name>
|
||||||
|
<value>60</value>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>logAbandoned</name>
|
||||||
|
<value>true</value>
|
||||||
|
</parameter>
|
||||||
|
</ResourceParams>
|
||||||
|
|
||||||
<!-- Define a database connection pool for MYSQL -->
|
<!-- Define a database connection pool for MYSQL -->
|
||||||
<Resource name="jdbc/petclinicMYSQL" auth="Container" type="javax.sql.DataSource"/>
|
<Resource name="jdbc/petclinicMYSQL" auth="Container" type="javax.sql.DataSource"/>
|
||||||
<ResourceParams name="jdbc/petclinicMYSQL">
|
<ResourceParams name="jdbc/petclinicMYSQL">
|
Loading…
Reference in a new issue