Databases Reference
In-Depth Information
The JDBC data source contains the parameters, such as the database host address, database
port, instance, and service name, needed to connect to the database. The data source also
includes transaction options and a pool for reusing the database connections, optimizing the
time spent opening these connections.
This chapter will go through some requirements of a hypothetic application named
DBApp
;
it will show how to create and configure the JDBC resources required by it. With reliability and
high availability in mind, the chapter will focus on connecting to an Oracle database and the
additional steps needed when using Oracle RAC.
Deeper JDBC transaction tunings, such as Two Phase Commit, Logging Last Resource, and
Global Transaction Support with no XA driver, among other options, are dependent on the
application's development and will not be the focus of this chapter.
Creating a JDBC data source
Consider that the
DBApp
application is deployed on the
PROD_Cluster
cluster and requires
a data source to connect to the database. The application looks for a non-XA data source with
the Java Naming and Directory Interface (JNDI) as
jdbc/ds-nonXA
.
The database is an Oracle database that is running in the
dbhost
hostname and listening
to the port
1521
. The listener is accepting requests to the service name
dbservice
.
In this recipe, a new JDBC data source to connect to the Oracle database will be created
and configured for the application
DBApp
.
Getting ready
The data source will be named
ds-nonXA
using the required JNDI
jdbc/ds-nonXA
.
The target will be the cluster
PROD_Cluster
, the same target as that of the
DBApp
application. The database username is
dbuser
and the password is
dbpwd
.
How to do it...
Carry out the following steps to create a JDBC data source:
1. Access the Administration Console with your web browser at
http://adminhost.domain.local:7001/console
.
2. Click on the Lock & Edit button to start a new edit session.
3. Click on the plus sign to open the Services tree on the left, and then click on
Data Sources.
4. Click on the New button and then click on Generic Data Source.
5. Type
ds-nonXA
in the Name field and
jdbc/ds-nonXA
in the JNDI Name field.
Search WWH ::
Custom Search