Added petclinic db

This commit is contained in:
Arjen Poutsma 2008-11-20 15:05:37 +00:00
parent 9d3cb3a47e
commit a51268a31c
21 changed files with 628 additions and 0 deletions

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<project name="setupDB" basedir="." default="all">
<target name="dropHSQLTables" if="useHSQL">
<echo message="Drop tables using: ${db.driver} ${db.url}" />
<sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue">
<classpath>
<fileset dir="${spring.root}/lib">
<include name="hsqldb/hsqldb.jar" />
</fileset>
</classpath>
<transaction src="${db.dir}/dropTables.txt" />
</sql>
</target>
<target name="createHSQLTables" if="useHSQL">
<echo message="Create tables using: ${db.driver} ${db.url}" />
<sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue">
<classpath>
<fileset dir="${spring.root}/lib">
<include name="hsqldb/hsqldb.jar" />
</fileset>
</classpath>
<transaction src="${db.dir}/hsqldb/initDB.txt" />
</sql>
</target>
<target name="dropMYSQLTables" if="useMYSQL">
<echo message="Dropping tables using: ${db.driver} ${db.url}" />
<sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue">
<classpath>
<fileset dir="${db.dir}/mysql">
<include name="mysql*.jar" />
</fileset>
</classpath>
<transaction src="${db.dir}/dropTables.txt" />
</sql>
</target>
<target name="createMYSQLTables" if="useMYSQL">
<echo message="Creating tables using: ${db.driver} ${db.url}" />
<sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue">
<classpath>
<fileset dir="${db.dir}/mysql">
<include name="mysql*.jar" />
</fileset>
</classpath>
<transaction src="${db.dir}/mysql/initDB.txt" />
</sql>
</target>
<target name="emptyTables">
<echo message="Emptying tables using: ${db.driver} ${db.url}" />
<sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}">
<classpath>
<fileset dir="${spring.root}/lib">
<include name="hsqldb/hsqldb.jar" />
</fileset>
<fileset dir="${db.dir}/mysql">
<include name="mysql*.jar" />
</fileset>
</classpath>
<transaction src="${db.dir}/emptyDB.txt" />
</sql>
</target>
<target name="populateTables">
<echo message="Populating tables using: ${db.driver} ${db.url}" />
<sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}">
<classpath>
<fileset dir="${spring.root}/lib">
<include name="hsqldb/hsqldb.jar" />
</fileset>
<fileset dir="${db.dir}/mysql">
<include name="mysql*.jar" />
</fileset>
</classpath>
<transaction src="${db.dir}/populateDB.txt" />
</sql>
</target>
<target name="all" depends="dropHSQLTables,createHSQLTables,dropMYSQLTables,createMYSQLTables,emptyTables,populateTables" />
</project>

View File

@ -0,0 +1,7 @@
DROP TABLE visits;
DROP TABLE pets;
DROP TABLE owners;
DROP TABLE types;
DROP TABLE vet_specialties;
DROP TABLE specialties;
DROP TABLE vets;

View File

@ -0,0 +1,7 @@
DELETE FROM vets;
DELETE FROM specialties;
DELETE FROM vet_specialties;
DELETE FROM types;
DELETE FROM owners;
DELETE FROM pets;
DELETE FROM visits;

View File

@ -0,0 +1,7 @@
DROP TABLE visits;
DROP TABLE pets;
DROP TABLE owners;
DROP TABLE types;
DROP TABLE vet_specialties;
DROP TABLE specialties;
DROP TABLE vets;

View File

@ -0,0 +1,55 @@
CREATE TABLE vets (
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
first_name VARCHAR(30),
last_name VARCHAR(30)
);
CREATE INDEX vets_last_name ON vets(last_name);
CREATE TABLE specialties (
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
name VARCHAR(80)
);
CREATE INDEX specialties_name ON specialties(name);
CREATE TABLE vet_specialties (
vet_id INTEGER NOT NULL,
specialty_id INTEGER NOT NULL
);
alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets(id);
alter table vet_specialties add constraint fk_vet_specialties_specialties foreign key (specialty_id) references specialties(id);
CREATE TABLE types (
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
name VARCHAR(80)
);
CREATE INDEX types_name ON types(name);
CREATE TABLE owners (
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
first_name VARCHAR(30),
last_name VARCHAR(30),
address VARCHAR(255),
city VARCHAR(80),
telephone VARCHAR(20)
);
CREATE INDEX owners_last_name ON owners(last_name);
CREATE TABLE pets (
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
name VARCHAR(30),
birth_date DATE,
type_id INTEGER NOT NULL,
owner_id INTEGER NOT NULL
);
alter table pets add constraint fk_pets_owners foreign key (owner_id) references owners(id);
alter table pets add constraint fk_pets_types foreign key (type_id) references types(id);
CREATE INDEX pets_name ON pets(name);
CREATE TABLE visits (
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
pet_id INTEGER NOT NULL,
visit_date DATE,
description VARCHAR(255)
);
alter table visits add constraint fk_visits_pets foreign key (pet_id) references pets(id);
CREATE INDEX visits_pet_id ON visits(pet_id);

View File

@ -0,0 +1,2 @@
"%JAVA_HOME%/bin/java" -classpath ..\..\..\..\lib\hsqldb\hsqldb.jar org.hsqldb.util.DatabaseManager

View File

@ -0,0 +1 @@
java -cp ../../../../lib/hsqldb/hsqldb.jar org.hsqldb.util.DatabaseManager

View File

@ -0,0 +1,17 @@
#HSQL Database Engine 1.8.0.9
#Thu Nov 20 16:03:56 CET 2008
hsqldb.script_format=0
runtime.gc_interval=0
sql.enforce_strict_size=false
hsqldb.cache_size_scale=10
readonly=false
hsqldb.nio_data_file=true
hsqldb.cache_scale=14
version=1.8.0
hsqldb.default_table_type=memory
hsqldb.cache_file_scale=1
hsqldb.log_size=200
modified=yes
hsqldb.cache_version=1.7.0
hsqldb.original_version=1.7.1
hsqldb.compatible_version=1.8.0

View File

@ -0,0 +1,72 @@
CREATE SCHEMA PUBLIC AUTHORIZATION DBA
CREATE MEMORY TABLE VETS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,FIRST_NAME VARCHAR(30),LAST_NAME VARCHAR(30))
CREATE INDEX VETS_LAST_NAME ON VETS(LAST_NAME)
CREATE MEMORY TABLE SPECIALTIES(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,NAME VARCHAR(80))
CREATE INDEX SPECIALTIES_NAME ON SPECIALTIES(NAME)
CREATE MEMORY TABLE VET_SPECIALTIES(VET_ID INTEGER NOT NULL,SPECIALTY_ID INTEGER NOT NULL,CONSTRAINT FK_VET_SPECIALTIES_VETS FOREIGN KEY(VET_ID) REFERENCES VETS(ID),CONSTRAINT FK_VET_SPECIALTIES_SPECIALTIES FOREIGN KEY(SPECIALTY_ID) REFERENCES SPECIALTIES(ID))
CREATE MEMORY TABLE TYPES(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,NAME VARCHAR(80))
CREATE INDEX TYPES_NAME ON TYPES(NAME)
CREATE MEMORY TABLE OWNERS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,FIRST_NAME VARCHAR(30),LAST_NAME VARCHAR(30),ADDRESS VARCHAR(255),CITY VARCHAR(80),TELEPHONE VARCHAR(20))
CREATE INDEX OWNERS_LAST_NAME ON OWNERS(LAST_NAME)
CREATE MEMORY TABLE PETS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,NAME VARCHAR(30),BIRTH_DATE DATE,TYPE_ID INTEGER NOT NULL,OWNER_ID INTEGER NOT NULL,CONSTRAINT FK_PETS_OWNERS FOREIGN KEY(OWNER_ID) REFERENCES OWNERS(ID),CONSTRAINT FK_PETS_TYPES FOREIGN KEY(TYPE_ID) REFERENCES TYPES(ID))
CREATE INDEX PETS_NAME ON PETS(NAME)
CREATE MEMORY TABLE VISITS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PET_ID INTEGER NOT NULL,VISIT_DATE DATE,DESCRIPTION VARCHAR(255),CONSTRAINT FK_VISITS_PETS FOREIGN KEY(PET_ID) REFERENCES PETS(ID))
CREATE INDEX VISITS_PET_ID ON VISITS(PET_ID)
ALTER TABLE VETS ALTER COLUMN ID RESTART WITH 7
ALTER TABLE SPECIALTIES ALTER COLUMN ID RESTART WITH 4
ALTER TABLE TYPES ALTER COLUMN ID RESTART WITH 7
ALTER TABLE OWNERS ALTER COLUMN ID RESTART WITH 11
ALTER TABLE PETS ALTER COLUMN ID RESTART WITH 15
ALTER TABLE VISITS ALTER COLUMN ID RESTART WITH 5
CREATE USER SA PASSWORD ""
GRANT DBA TO SA
SET WRITE_DELAY 60
SET SCHEMA PUBLIC
INSERT INTO VETS VALUES(1,'James','Carter')
INSERT INTO VETS VALUES(2,'Helen','Leary')
INSERT INTO VETS VALUES(3,'Linda','Douglas')
INSERT INTO VETS VALUES(4,'Rafael','Ortega')
INSERT INTO VETS VALUES(5,'Henry','Stevens')
INSERT INTO VETS VALUES(6,'Sharon','Jenkins')
INSERT INTO SPECIALTIES VALUES(1,'radiology')
INSERT INTO SPECIALTIES VALUES(2,'surgery')
INSERT INTO SPECIALTIES VALUES(3,'dentistry')
INSERT INTO VET_SPECIALTIES VALUES(2,1)
INSERT INTO VET_SPECIALTIES VALUES(3,2)
INSERT INTO VET_SPECIALTIES VALUES(3,3)
INSERT INTO VET_SPECIALTIES VALUES(4,2)
INSERT INTO VET_SPECIALTIES VALUES(5,1)
INSERT INTO TYPES VALUES(1,'cat')
INSERT INTO TYPES VALUES(2,'dog')
INSERT INTO TYPES VALUES(3,'lizard')
INSERT INTO TYPES VALUES(4,'snake')
INSERT INTO TYPES VALUES(5,'bird')
INSERT INTO TYPES VALUES(6,'hamster')
INSERT INTO OWNERS VALUES(1,'Georges','Franklin','110 W. Liberty St.','Madison','6085551023')
INSERT INTO OWNERS VALUES(2,'Betty','Davis','638 Cardinal Ave.','Sun Prairie','234234')
INSERT INTO OWNERS VALUES(3,'Eduardo','Rodriquez','2693 Commerce St.','McFarland','6085558763')
INSERT INTO OWNERS VALUES(4,'Harold','Davis','563 Friendly St.','Windsor','6085553198')
INSERT INTO OWNERS VALUES(5,'Peter','McTavish','2387 S. Fair Way','Madison','6085552765')
INSERT INTO OWNERS VALUES(6,'Jean','Coleman','105 N. Lake St.','Monona','6085552654')
INSERT INTO OWNERS VALUES(7,'Jeff','Black','1450 Oak Blvd.','Monona','6085555387')
INSERT INTO OWNERS VALUES(8,'Maria','Escobito','345 Maple St.','Madison','6085557683')
INSERT INTO OWNERS VALUES(9,'David','Schroeder','2749 Blackhawk Trail','Madison','6085559435')
INSERT INTO OWNERS VALUES(10,'Carlos','Estaban','2335 Independence La.','Waunakee','6085555487')
INSERT INTO PETS VALUES(1,'Leo','2000-09-07',1,1)
INSERT INTO PETS VALUES(2,'Basil','2002-08-06',6,2)
INSERT INTO PETS VALUES(3,'Rosy','2001-04-17',2,3)
INSERT INTO PETS VALUES(4,'Jewel','2000-03-07',2,3)
INSERT INTO PETS VALUES(5,'Iggy','2000-11-30',3,4)
INSERT INTO PETS VALUES(6,'George','2000-01-20',4,5)
INSERT INTO PETS VALUES(7,'Samantha','1995-09-04',1,6)
INSERT INTO PETS VALUES(8,'Max','1995-09-04',1,6)
INSERT INTO PETS VALUES(9,'Lucky','1999-08-06',5,7)
INSERT INTO PETS VALUES(10,'Mulligan','1997-02-24',2,8)
INSERT INTO PETS VALUES(11,'Freddy','2000-03-09',5,9)
INSERT INTO PETS VALUES(12,'Lucky','2000-06-24',2,10)
INSERT INTO PETS VALUES(13,'Sly','2002-06-08',1,10)
INSERT INTO PETS VALUES(14,'Arjen Poutsma','1974-11-29',5,1)
INSERT INTO VISITS VALUES(1,7,'1996-03-04','rabies shot')
INSERT INTO VISITS VALUES(2,8,'1996-03-04','rabies shot')
INSERT INTO VISITS VALUES(3,8,'1996-06-04','neutered')
INSERT INTO VISITS VALUES(4,7,'1996-09-04','spayed')

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Context path="/petclinic" docBase="petclinic" debug="4" reloadable="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>
</Context>

View File

@ -0,0 +1 @@
"%JAVA_HOME%/bin/java" -classpath ..\..\..\..\lib\hsqldb\hsqldb.jar org.hsqldb.Server -database petclinic

View File

@ -0,0 +1 @@
server.trace=true

View File

@ -0,0 +1 @@
java -classpath ../../../ivy-cache/repository/org.hsqldb/com.springsource.org.hsqldb/1.8.0.9/com.springsource.org.hsqldb-1.8.0.9.jar org.hsqldb.Server -database petclinic

View File

@ -0,0 +1,3 @@
CREATE DATABASE petclinic;
GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc';

View File

@ -0,0 +1 @@
DROP DATABASE petclinic;

View File

@ -0,0 +1,58 @@
USE petclinic;
CREATE TABLE vets (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(30),
last_name VARCHAR(30),
INDEX(last_name)
) engine=InnoDB;
CREATE TABLE specialties (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(80),
INDEX(name)
) engine=InnoDB;
CREATE TABLE vet_specialties (
vet_id INT(4) UNSIGNED NOT NULL,
specialty_id INT(4) UNSIGNED NOT NULL
) engine=InnoDB;
ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_vets FOREIGN KEY (vet_id) REFERENCES vets(id);
ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_specialties FOREIGN KEY (specialty_id) REFERENCES specialties(id);
CREATE TABLE types (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(80),
INDEX(name)
) engine=InnoDB;
CREATE TABLE owners (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(30),
last_name VARCHAR(30),
address VARCHAR(255),
city VARCHAR(80),
telephone VARCHAR(20),
INDEX(last_name)
) engine=InnoDB;
CREATE TABLE pets (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(30),
birth_date DATE,
type_id INT(4) UNSIGNED NOT NULL,
owner_id INT(4) UNSIGNED NOT NULL,
INDEX(name)
) engine=InnoDB;
ALTER TABLE pets ADD CONSTRAINT fk_pets_owners FOREIGN KEY (owner_id) REFERENCES owners(id);
ALTER TABLE pets ADD CONSTRAINT fk_pets_types FOREIGN KEY (type_id) REFERENCES types(id);
CREATE INDEX pets_name ON pets(name);
CREATE TABLE visits (
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
pet_id INT(4) UNSIGNED NOT NULL,
visit_date DATE,
description VARCHAR(255),
INDEX(pet_id)
) engine=InnoDB;
ALTER TABLE visits ADD CONSTRAINT fk_visits_pets FOREIGN KEY (pet_id) REFERENCES pets(id);

View File

@ -0,0 +1,26 @@
================================================================================
=== Spring PetClinic sample application - MySQL Configuration ===
================================================================================
@author Sam Brannen
--------------------------------------------------------------------------------
1) Download and install the MySQL database (e.g., MySQL Community Server 5.0.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.
3) Create the PetClinic database and user by executing the "db/mysql/createDB.txt"
script.
4) Open "build.properties" in PetClinic's root directory and follow the
instructions in section: "NOTE: To CONFIGURE the DATABASE...".
5) If you did not already do so in step 4, open "src/jdbc.properties", comment
out all properties in the "HSQL Settings" section, uncomment all properties
in the "MySQL Settings" section, and verify that your connection settings
are consistent in both "build.properties" and "src/jdbc.properties".

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Context path="/petclinic" docBase="petclinic" debug="4" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_petclinic_log." suffix=".txt" timestamp="true"/>
<!-- Define a database connection pool for MYSQL -->
<Resource name="jdbc/petclinicMYSQL" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/petclinicMYSQL">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<!--
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.
-->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/petclinic?autoReconnect=true</value>
</parameter>
<parameter>
<name>username</name>
<value>pc</value>
</parameter>
<parameter>
<name>password</name>
<value>pc</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>
</Context>

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Context path="/petclinic" docBase="petclinic" debug="4" reloadable="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 -->
<Resource name="jdbc/petclinicMYSQL" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/petclinicMYSQL">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<!--
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.
-->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/petclinic?autoReconnect=true</value>
</parameter>
<parameter>
<name>username</name>
<value>pc</value>
</parameter>
<parameter>
<name>password</name>
<value>pc</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>
</Context>

View File

@ -0,0 +1,53 @@
INSERT INTO vets VALUES (1, 'James', 'Carter');
INSERT INTO vets VALUES (2, 'Helen', 'Leary');
INSERT INTO vets VALUES (3, 'Linda', 'Douglas');
INSERT INTO vets VALUES (4, 'Rafael', 'Ortega');
INSERT INTO vets VALUES (5, 'Henry', 'Stevens');
INSERT INTO vets VALUES (6, 'Sharon', 'Jenkins');
INSERT INTO specialties VALUES (1, 'radiology');
INSERT INTO specialties VALUES (2, 'surgery');
INSERT INTO specialties VALUES (3, 'dentistry');
INSERT INTO vet_specialties VALUES (2, 1);
INSERT INTO vet_specialties VALUES (3, 2);
INSERT INTO vet_specialties VALUES (3, 3);
INSERT INTO vet_specialties VALUES (4, 2);
INSERT INTO vet_specialties VALUES (5, 1);
INSERT INTO types VALUES (1, 'cat');
INSERT INTO types VALUES (2, 'dog');
INSERT INTO types VALUES (3, 'lizard');
INSERT INTO types VALUES (4, 'snake');
INSERT INTO types VALUES (5, 'bird');
INSERT INTO types VALUES (6, 'hamster');
INSERT INTO owners VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023');
INSERT INTO owners VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749');
INSERT INTO owners VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763');
INSERT INTO owners VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198');
INSERT INTO owners VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765');
INSERT INTO owners VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654');
INSERT INTO owners VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387');
INSERT INTO owners VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683');
INSERT INTO owners VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435');
INSERT INTO owners VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487');
INSERT INTO pets VALUES (1, 'Leo', '2000-09-07', 1, 1);
INSERT INTO pets VALUES (2, 'Basil', '2002-08-06', 6, 2);
INSERT INTO pets VALUES (3, 'Rosy', '2001-04-17', 2, 3);
INSERT INTO pets VALUES (4, 'Jewel', '2000-03-07', 2, 3);
INSERT INTO pets VALUES (5, 'Iggy', '2000-11-30', 3, 4);
INSERT INTO pets VALUES (6, 'George', '2000-01-20', 4, 5);
INSERT INTO pets VALUES (7, 'Samantha', '1995-09-04', 1, 6);
INSERT INTO pets VALUES (8, 'Max', '1995-09-04', 1, 6);
INSERT INTO pets VALUES (9, 'Lucky', '1999-08-06', 5, 7);
INSERT INTO pets VALUES (10, 'Mulligan', '1997-02-24', 2, 8);
INSERT INTO pets VALUES (11, 'Freddy', '2000-03-09', 5, 9);
INSERT INTO pets VALUES (12, 'Lucky', '2000-06-24', 2, 10);
INSERT INTO pets VALUES (13, 'Sly', '2002-06-08', 1, 10);
INSERT INTO visits VALUES (1, 7, '1996-03-04', 'rabies shot');
INSERT INTO visits VALUES (2, 8, '1996-03-04', 'rabies shot');
INSERT INTO visits VALUES (3, 8, '1996-06-04', 'neutered');
INSERT INTO visits VALUES (4, 7, '1996-09-04', 'spayed');