Skip to content

Instantly share code, notes, and snippets.

@nagetsum
Created June 8, 2020 06:56
Show Gist options
  • Save nagetsum/bebfde8bff197c367badc03875debb4b to your computer and use it in GitHub Desktop.
Save nagetsum/bebfde8bff197c367badc03875debb4b to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/myappDS"
auth="Container"
type="javax.sql.DataSource"
initialSize="20" maxTotal="20" maxIdle="20" maxWaitMillis="10000"
username="postgres" password="postgres" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/test"
connectionProperties="loginTimeout=10;socketTimeout=310"
validationQuery="SELECT 1"
validationQueryTimeout="30" />
</Context>
lookup above datasource in application code:
InitialContext.doLookup("java:comp/env/jdbc/myappDS");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment