Creating datasources and a connection pool

To create a datasource and a connection pool to help you use databases in your project, edit the $GLASSFISH_HOME/glassfish/domains/[domain_name]/config/domain.xml file. Inside the <resources> node, insert a child node like this one:

<jdbc-connection-pool   pool-resize-quantity="4"   max-pool-size="64"   max-wait-time-in-millis="120000"   driver-classname="com.mysql.jdbc.Driver"   datasource-classname="com.mysql.jdbc.jdbc2.optional  .MysqlDataSource"   steady-pool-size="16"   name="MysqlPool"   idle-timeout-in-seconds="600"   res-type="javax.sql.DataSource">      <property name="databaseName" value="database"></property>      <property name="serverName" value="[host]"></property> <property name="user" value="user"></property> ...

Get Java EE 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.