Templates to create JDBC Connection Pool & Resource
Often, setting up connection pool (datasource) against various databases will require knowledge on
mandatory property names to successfully connect to database.
GlassFish V2 has templates to create connection pool & resource against various databases & jdbc drivers.
Once appropriate values for properties like, user, password, databaseName, serverName are set in the template, they
can be used multiple times.
GlassFish V2 has templates available in GF_INSTALL_DIR/lib/install/templates/resources/jdbc
How to use :
| 1)
copy the jdbc-driver to
AS_INSTALL_DIR/domains/<DOMAIN_NAME>/lib/ext 2) restart appserver 3) edit the appropriate jdbc-driver template to fill username, password, hostname, databasename, portnumber etc., 3a) [Optional] select appropriate resource-type & datasource-classname. Templates are provided with the list of datasource-classnames for respective resource-types of the jdbc-vendor, if available. 4) asadmin add-resources jdbc-driver-template.xml (eg: AS_INSTALL_DIR/lib/install/templates/resources/jdbc/javadb_type4_datasource.xml) 5) asadmin ping-connection-pool connection-pool-name |
For more information, refer GF_INSTALL_DIR/lib/install/templates/resources/jdbc/README and respective datasource-template.xml files.
These templates can be used against GlassFish V1 also.
Templates :
| Database
Vendor |
JDBC
Driver Vendor |
datasource-template-file |
| JavaDB
/ Derby |
Derby |
javadb_type4_datasource.xml |
| Oracle |
Oracle
Thin Driver |
oracle_type4_datasource.xml |
| Oracle |
Inet
Driver |
oracle_inet_datasource.xml |
| Oracle |
Sun
bundled DataDirect Driver (available in SJSAS EE builds) |
oracle_dd_datasource.xml |
| MySQL |
MySQL
Connector/J |
mysql_type4_datasource.xml |
| PostgreSQL |
PostgreSQL
Driver |
postgresql_type4_datasource.xml |
| DB2 |
Sun
bundled DataDirect Driver (available in SJSAS EE builds) |
db2_dd_datasource.xml |
| DB2 |
IBM
DB2 JDBC type-4 driver |
db2_jcc_datasource.xml |
| Sybase |
Sun
bundled DataDirect Driver (available in SJSAS EE builds) |
sybase_dd_datasource.xml |
| Sybase |
Inet
Driver |
sybase_inet_datasource.xml |
| Sybase |
jConnect
Driver |
sybase_jconn_datasource.xml |
| Microsoft
SQL Server |
Sun
bundled DataDirect Driver (available in SJSAS EE builds) |
microsoft_dd_datasource.xml |
| Microsoft SQL Server | Inet
Driver |
microsoft_inet_datasource.xml |
| Microsoft SQL Server | jTDS
Driver |
microsoft_jtds_datasource.xml |
| Microsoft
SQL Server 2000 |
Microsoft |
microsoft_sqlserver2000_datasource.xml |
| Microsoft SQL Server 2005 | Microsoft |
microsoft_sqlserver2005_datasource.xml |
The templates listed above will be available in GlassFish v2 b51
Similarly, templates for other databases can be done.
If you have a template for a particular database that is not listed here,
please post it to dev@glassfish.dev.java.net or users@glassfish.dev.java.net