CREATE TABLE cat ( cat_id varchar(20) NOT NULL, name varchar(20) NOT NULL, sex char(1), weight float, PRIMARY KEY (cat_id) ); insert cat values(1, ada, F, 5); insert cat values(2, belinda, F, 10); commit; |
<Context path="/hellohibernate" docBase="hellohibernate" reloadable="true"> <Resource name="jdbc/hellohibernate" scope="Shareable" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/hellohibernate"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <!-- DBCP database connection settings --> <parameter> <name>url</name> <value>jdbc:mysql://localhost:3306/test</value> </parameter> <parameter> <name>driverClassName</name><value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>username</name> <value>yourusername</value> </parameter> <parameter> <name>password</name> <value>yourpassword</value> </parameter> <!-- DBCP connection pooling options --> <parameter> <name>maxWait</name> <value>3000</value> </parameter> <parameter> <name>maxIdle</name> <value>100</value> </parameter> <parameter> <name>maxActive</name> <value>10</value> </parameter> </ResourceParams> </Context> |