Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Upgrade and Migration Guide

- Previous: Preparing for Migrating the iBank Application
- Next: Assembling Application for Deployment

## Configuring Database Connectivity

In order to deploy an application to the target server, you must add a connection pool, add a JDBC resource and a persistence manager.

This section discusses the following topics:

- Adding a Connection Pool

- Adding a JDBC Resource

- Adding a Persistence Manager

Note –

Before you begin these steps, make sure that the domain to which the application will be deployed is in the running state. These instructions assume that the application will be deployed to the default domain, domain1.

Use the asadmin utility in the Application Server bin directory to perform these tasks.

### Adding a Connection Pool

A JDBC connection pool is a group of reusable connections for a particular database. Because creating each new physical connection is time consuming, the server maintains a pool of available connections to increase performance. When an application requests a connection, it obtains one from the pool. When an application closes a connection, the connection is returned to the pool.

Use the `asadmin create-jdbc-connection-pool` command to add a connection pool to the server. The syntax of the command is given below.

    asadmin create-jdbc-connection-pool
         --user  admin_user
         --password admin_password
         --host localhost
         --port portno
         --datasourceclassname dsclassname
         --property User=ibank_user:Password=ibank_user:URL_PROP=db_url TMB

where, dsclassname is:

- `oracle.jdbc.pool.OracleDataSource` for Oracle

- `com.pointbase.jdbc.jdbcDataSource` for PointBase

URL_PROP is:

- `url` for Oracle

- `DatabaseName` for PointBase

db_url is:

- `jdbc:oracle:thin:@`ORACLE_HOST`:1521:SID` for Oracle, where ORACLE_HOST is the machine name/IP address on which the database is installed, and SID is the System ID of the Oracle database.

- `jdbc:pointbase:server://`POINTBASE_HOST:9092`/migration-samples` for Pointbase, where POINTBASE_HOST is the machine name/IP address on which the database is installed. This will be localhost in most cases.

### Adding a JDBC Resource

A JDBC resource (data source) provides applications with a means of connecting to a database. Before creating a JDBC resource, you must first create a JDBC connection pool.

Use the `asadmin create-jdbc-resource` command to add resource.

`asadmin create-jdbc-resource --user` admin_user `--password` admin_password `--host localhost --port` portno `--connectionpoolid TMB jdbc/IBank`

### Adding a Persistence Manager

A persistence manager is required for backward compatibility. To run on version 7 of the Application Server, a persistent manager resource was required for applications with container-managed persistent beans (a type of EJB component).

Use the `asadmin create-persistence-resource` command.

`asadmin create-persistence-resource --user` admin_user `--password` admin_password `--host localhost --port` portno `--connectionpoolid TMB --factoryclass com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpljdo/pmf`

- Previous: Preparing for Migrating the iBank Application
- Next: Assembling Application for Deployment

- © 2010, Oracle Corporation and/or its affiliates