Tomcat datasource definition (H2 database):
server.xml:
... <GlobalNamingResources> ... <Resource name="jdbc/h2" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" driverClassName="org.h2.Driver" url="jdbc:h2:tcp://localhost/mem:db1" <!-- for in-memory DB: --> <!-- url="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" --> username="xxx" password="xxx" initialSize="5" minIdle="2" maxIdle="10" maxActive="20" maxWait="15000"
/> </GlobalNamingResources>EDIT: Please remember about:
validationQuery="select 1" validationQueryTimeout="10" validationInterval="10000" testOnBorrow="true"context.xml:
<Context> ... <ResourceLink global="jdbc/h2" name="jdbc/h2" type="javax.sql.DataSource" /> </Context>web.xml:
<resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/h2</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
No comments :
Post a Comment