From a51268a31c2bb02fd8edaacc662e36ceaa2a80c9 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Thu, 20 Nov 2008 15:05:37 +0000 Subject: [PATCH] Added petclinic db --- .../db/build.xml | 85 +++++++++++++ .../db/dropTables.txt | 7 ++ .../db/emptyDB.txt | 7 ++ .../db/hsqldb/dropDB.txt | 7 ++ .../db/hsqldb/initDB.txt | 55 +++++++++ .../db/hsqldb/manager.bat | 2 + .../db/hsqldb/manager.sh | 1 + .../db/hsqldb/petclinic.log | 0 .../db/hsqldb/petclinic.properties | 17 +++ .../db/hsqldb/petclinic.script | 72 +++++++++++ .../db/hsqldb/petclinic_tomcat_hsql.xml | 55 +++++++++ .../db/hsqldb/server.bat | 1 + .../db/hsqldb/server.properties | 1 + .../db/hsqldb/server.sh | 1 + .../db/mysql/createDB.txt | 3 + .../db/mysql/dropDB.txt | 1 + .../db/mysql/initDB.txt | 58 +++++++++ .../db/mysql/petclinic_db_setup_mysql.txt | 26 ++++ .../db/mysql/petclinic_tomcat_mysql.xml | 64 ++++++++++ .../db/petclinic_tomcat_all.xml | 112 ++++++++++++++++++ .../db/populateDB.txt | 53 +++++++++ 21 files changed, 628 insertions(+) create mode 100644 org.springframework.samples.petclinic/db/build.xml create mode 100644 org.springframework.samples.petclinic/db/dropTables.txt create mode 100644 org.springframework.samples.petclinic/db/emptyDB.txt create mode 100644 org.springframework.samples.petclinic/db/hsqldb/dropDB.txt create mode 100644 org.springframework.samples.petclinic/db/hsqldb/initDB.txt create mode 100644 org.springframework.samples.petclinic/db/hsqldb/manager.bat create mode 100644 org.springframework.samples.petclinic/db/hsqldb/manager.sh create mode 100644 org.springframework.samples.petclinic/db/hsqldb/petclinic.log create mode 100644 org.springframework.samples.petclinic/db/hsqldb/petclinic.properties create mode 100644 org.springframework.samples.petclinic/db/hsqldb/petclinic.script create mode 100644 org.springframework.samples.petclinic/db/hsqldb/petclinic_tomcat_hsql.xml create mode 100644 org.springframework.samples.petclinic/db/hsqldb/server.bat create mode 100644 org.springframework.samples.petclinic/db/hsqldb/server.properties create mode 100644 org.springframework.samples.petclinic/db/hsqldb/server.sh create mode 100644 org.springframework.samples.petclinic/db/mysql/createDB.txt create mode 100644 org.springframework.samples.petclinic/db/mysql/dropDB.txt create mode 100644 org.springframework.samples.petclinic/db/mysql/initDB.txt create mode 100644 org.springframework.samples.petclinic/db/mysql/petclinic_db_setup_mysql.txt create mode 100644 org.springframework.samples.petclinic/db/mysql/petclinic_tomcat_mysql.xml create mode 100644 org.springframework.samples.petclinic/db/petclinic_tomcat_all.xml create mode 100644 org.springframework.samples.petclinic/db/populateDB.txt diff --git a/org.springframework.samples.petclinic/db/build.xml b/org.springframework.samples.petclinic/db/build.xml new file mode 100644 index 00000000000..b6d09936b01 --- /dev/null +++ b/org.springframework.samples.petclinic/db/build.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/org.springframework.samples.petclinic/db/dropTables.txt b/org.springframework.samples.petclinic/db/dropTables.txt new file mode 100644 index 00000000000..90ae6329f90 --- /dev/null +++ b/org.springframework.samples.petclinic/db/dropTables.txt @@ -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; diff --git a/org.springframework.samples.petclinic/db/emptyDB.txt b/org.springframework.samples.petclinic/db/emptyDB.txt new file mode 100644 index 00000000000..d5dd8728c0e --- /dev/null +++ b/org.springframework.samples.petclinic/db/emptyDB.txt @@ -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; diff --git a/org.springframework.samples.petclinic/db/hsqldb/dropDB.txt b/org.springframework.samples.petclinic/db/hsqldb/dropDB.txt new file mode 100644 index 00000000000..90ae6329f90 --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/dropDB.txt @@ -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; diff --git a/org.springframework.samples.petclinic/db/hsqldb/initDB.txt b/org.springframework.samples.petclinic/db/hsqldb/initDB.txt new file mode 100644 index 00000000000..a75bfbbd86d --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/initDB.txt @@ -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); diff --git a/org.springframework.samples.petclinic/db/hsqldb/manager.bat b/org.springframework.samples.petclinic/db/hsqldb/manager.bat new file mode 100644 index 00000000000..f42718768f9 --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/manager.bat @@ -0,0 +1,2 @@ +"%JAVA_HOME%/bin/java" -classpath ..\..\..\..\lib\hsqldb\hsqldb.jar org.hsqldb.util.DatabaseManager + diff --git a/org.springframework.samples.petclinic/db/hsqldb/manager.sh b/org.springframework.samples.petclinic/db/hsqldb/manager.sh new file mode 100644 index 00000000000..5b42b70a16c --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/manager.sh @@ -0,0 +1 @@ +java -cp ../../../../lib/hsqldb/hsqldb.jar org.hsqldb.util.DatabaseManager diff --git a/org.springframework.samples.petclinic/db/hsqldb/petclinic.log b/org.springframework.samples.petclinic/db/hsqldb/petclinic.log new file mode 100644 index 00000000000..e69de29bb2d diff --git a/org.springframework.samples.petclinic/db/hsqldb/petclinic.properties b/org.springframework.samples.petclinic/db/hsqldb/petclinic.properties new file mode 100644 index 00000000000..f6b97678f03 --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/petclinic.properties @@ -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 diff --git a/org.springframework.samples.petclinic/db/hsqldb/petclinic.script b/org.springframework.samples.petclinic/db/hsqldb/petclinic.script new file mode 100644 index 00000000000..e4e4eddd280 --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/petclinic.script @@ -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') diff --git a/org.springframework.samples.petclinic/db/hsqldb/petclinic_tomcat_hsql.xml b/org.springframework.samples.petclinic/db/hsqldb/petclinic_tomcat_hsql.xml new file mode 100644 index 00000000000..27c1f713586 --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/petclinic_tomcat_hsql.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + factory + org.apache.commons.dbcp.BasicDataSourceFactory + + + + driverClassName + org.hsqldb.jdbcDriver + + + url + jdbc:hsqldb:hsql://localhost:9001 + + + username + sa + + + + maxActive + 50 + + + maxIdle + 10 + + + maxWait + 10000 + + + removeAbandoned + true + + + removeAbandonedTimeout + 60 + + + logAbandoned + true + + + + + diff --git a/org.springframework.samples.petclinic/db/hsqldb/server.bat b/org.springframework.samples.petclinic/db/hsqldb/server.bat new file mode 100644 index 00000000000..d2a65a6e2c0 --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/server.bat @@ -0,0 +1 @@ +"%JAVA_HOME%/bin/java" -classpath ..\..\..\..\lib\hsqldb\hsqldb.jar org.hsqldb.Server -database petclinic diff --git a/org.springframework.samples.petclinic/db/hsqldb/server.properties b/org.springframework.samples.petclinic/db/hsqldb/server.properties new file mode 100644 index 00000000000..1572908fa66 --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/server.properties @@ -0,0 +1 @@ +server.trace=true diff --git a/org.springframework.samples.petclinic/db/hsqldb/server.sh b/org.springframework.samples.petclinic/db/hsqldb/server.sh new file mode 100644 index 00000000000..0021e37f558 --- /dev/null +++ b/org.springframework.samples.petclinic/db/hsqldb/server.sh @@ -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 diff --git a/org.springframework.samples.petclinic/db/mysql/createDB.txt b/org.springframework.samples.petclinic/db/mysql/createDB.txt new file mode 100644 index 00000000000..5b4b3859e9a --- /dev/null +++ b/org.springframework.samples.petclinic/db/mysql/createDB.txt @@ -0,0 +1,3 @@ +CREATE DATABASE petclinic; + +GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; \ No newline at end of file diff --git a/org.springframework.samples.petclinic/db/mysql/dropDB.txt b/org.springframework.samples.petclinic/db/mysql/dropDB.txt new file mode 100644 index 00000000000..e1209da0e5e --- /dev/null +++ b/org.springframework.samples.petclinic/db/mysql/dropDB.txt @@ -0,0 +1 @@ +DROP DATABASE petclinic; diff --git a/org.springframework.samples.petclinic/db/mysql/initDB.txt b/org.springframework.samples.petclinic/db/mysql/initDB.txt new file mode 100644 index 00000000000..0007ee3a339 --- /dev/null +++ b/org.springframework.samples.petclinic/db/mysql/initDB.txt @@ -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); diff --git a/org.springframework.samples.petclinic/db/mysql/petclinic_db_setup_mysql.txt b/org.springframework.samples.petclinic/db/mysql/petclinic_db_setup_mysql.txt new file mode 100644 index 00000000000..5d8b1dcc690 --- /dev/null +++ b/org.springframework.samples.petclinic/db/mysql/petclinic_db_setup_mysql.txt @@ -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". diff --git a/org.springframework.samples.petclinic/db/mysql/petclinic_tomcat_mysql.xml b/org.springframework.samples.petclinic/db/mysql/petclinic_tomcat_mysql.xml new file mode 100644 index 00000000000..d1c5a3b04e3 --- /dev/null +++ b/org.springframework.samples.petclinic/db/mysql/petclinic_tomcat_mysql.xml @@ -0,0 +1,64 @@ + + + + + + + + + + factory + org.apache.commons.dbcp.BasicDataSourceFactory + + + + driverClassName + org.gjt.mm.mysql.Driver + + + + url + jdbc:mysql://localhost:3306/petclinic?autoReconnect=true + + + username + pc + + + password + pc + + + + maxActive + 50 + + + maxIdle + 10 + + + maxWait + 10000 + + + removeAbandoned + true + + + removeAbandonedTimeout + 60 + + + logAbandoned + true + + + + + diff --git a/org.springframework.samples.petclinic/db/petclinic_tomcat_all.xml b/org.springframework.samples.petclinic/db/petclinic_tomcat_all.xml new file mode 100644 index 00000000000..ed45c5cd339 --- /dev/null +++ b/org.springframework.samples.petclinic/db/petclinic_tomcat_all.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + factory + org.apache.commons.dbcp.BasicDataSourceFactory + + + + driverClassName + org.hsqldb.jdbcDriver + + + url + jdbc:hsqldb:hsql://localhost:9001 + + + username + sa + + + + maxActive + 50 + + + maxIdle + 10 + + + maxWait + 10000 + + + removeAbandoned + true + + + removeAbandonedTimeout + 60 + + + logAbandoned + true + + + + + + + + factory + org.apache.commons.dbcp.BasicDataSourceFactory + + + + driverClassName + org.gjt.mm.mysql.Driver + + + + url + jdbc:mysql://localhost:3306/petclinic?autoReconnect=true + + + username + pc + + + password + pc + + + + maxActive + 50 + + + maxIdle + 10 + + + maxWait + 10000 + + + removeAbandoned + true + + + removeAbandonedTimeout + 60 + + + logAbandoned + true + + + + + diff --git a/org.springframework.samples.petclinic/db/populateDB.txt b/org.springframework.samples.petclinic/db/populateDB.txt new file mode 100644 index 00000000000..1bf0c4a6edb --- /dev/null +++ b/org.springframework.samples.petclinic/db/populateDB.txt @@ -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');