Skip to content

Instantly share code, notes, and snippets.

@EugenyB
Last active December 13, 2016 15:09
Show Gist options
  • Save EugenyB/5dbb4693669810c3db2f to your computer and use it in GitHub Desktop.
Save EugenyB/5dbb4693669810c3db2f to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<!--
Заполнить данные - см.комментарии
-->
<resources>
<!-- имя пула (заменить poolname), например java:app/db_pool-->
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false"
connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0"
connection-validation-method="auto-commit"
datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
fail-all-connections="false" idle-timeout-in-seconds="300"
is-connection-validation-required="false" is-isolation-level-guaranteed="true"
lazy-connection-association="false" lazy-connection-enlistment="false"
match-connections="false" max-connection-usage-count="0" max-pool-size="32"
max-wait-time-in-millis="60000"
name="poolname"
non-transactional-connections="false" pool-resize-quantity="2"
res-type="javax.sql.DataSource"
statement-timeout-in-seconds="-1" steady-pool-size="8"
validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
<property name="portNumber" value="3306"/>
<!-- название БД -->
<property name="databaseName" value="dbname"/>
<!-- Имя пользователя - логин к БД -->
<property name="User" value="user"/>
<!-- Пароль к БД -->
<property name="Password" value="password"/>
<!-- URL БД - в конце имя БД -->
<property name="URL" value="jdbc:mysql://localhost:3306/dbname"/>
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<!-- Если нужно создавать БД автоматически, добавить эту строку -->
<property name="createDatabaseIfNotExist" value="true"/>
</jdbc-connection-pool>
<!-- JNDI имя ресурса и имя пула (заменить resourcename и poolname)-->
<jdbc-resource enabled="true" jndi-name="java:app/jdbc/resourcename" object-type="user" pool-name="poolname"/>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment