Building The Example; Configuring Database Access - Red Hat APPLICATION SERVER - JONAS Tutorial

Jonas
Hide thumbs Also See for APPLICATION SERVER - JONAS:
Table of Contents

Advertisement

28

6.1.2. Building the Example

The simplest way to compile this and all examples is to go to the
directory and enter the following command line as user
ant -find build.xml install
This command compiles all examples in the
6.1.3. Configuring Database Access
In order to run this example, you must be able to access a relational database. Typically you would
use PostgreSQL, as it is preconfigured with Red Hat Application Server. JOnAS will create and use
a DataSource object that must be configured for the database you intend to use. These DataSource
objects are configured via properties files and are referenced in the
Section 4.1.2 JOnAS Configuration Files).
The
file for your database needs to be in a location where your JRE can find it. (For example, if
jar
you are using PostgreSQL—Red Hat Edition and the IBM JRE, the following is necessary:
$ su
# cd /usr/lib/jvm/java-java_version-ibm-IBM_java_version/jre/lib/ext
# ln -s /usr/share/java/rh-postgresql3.jar .
6.1.3.1. Defining a Datasource
This example requires that a datasource named
default name used in the database properties files provided in the
Hat Application Server provides configuration files for a variety of common RDBMSs. PostgreSQL is
the preconfigured option.
the Red Hat Application Server default installation.
6.1.3.2. Creating the Database
JOnAS does not automatically create the database for you—you have to create it prior to running this
example. The
Account.sql
an
file that can be used with InstantDB.
Account.idb
For example, for PostgreSQL:
$ su
# su -s /bin/sh -c "psql -p 5433 db_jonas" jonas
sampleaccount=# \i Account.pgsql
sampleaccount=# \q
Note
The
command changes your
su
$JONAS_ROOT/examples/src/eb
through the
psql
Additional information about database configuration is available in the Configuring Database Service
chapter of the Red Hat Application Server User Guide.
$JONAS_ROOT/conf/PostgreSQL1.properties
file can be used with most SQL-92 compatible databases. There is also
pwd
examples directory so that the
interface.
:
jonas
$JONAS_ROOT/examples/src
is available in the JOnAS server. This is the
jdbc_1
. Thus, after you run
Chapter 6. Entity Beans
$JONAS_ROOT/examples/src
directory.
jonas.properties
$JONAS_ROOT/conf
is set up to work with
, you must go back to the
su
file can be found
Account.pgsql
file (see
directory. Red

Advertisement

Table of Contents
loading

This manual is also suitable for:

Application server

Table of Contents