Sun Microsystems Logo




Using PointBase with the Samples


Application Server includes the PointBase Network Server version 4.8 database as part of the installable components except when the application server is installed as part of a Solaris 9 installation.

When PointBase is installed as part of an application server installation, a PointBase Type 4 JDBC[tm] driver is included in the application server environment. During installation of the application server, PointBase is installed in the following location:

<install_dir>/pointbase/

The documentation for the database is available at:

 http://www.pointbase.com/

This document describes several aspects of working with the PointBase server and Application Server:


» Installing and Configuring PointBase Server (if not already installed)

» Creating Your Own PointBase Runtime Environment (optional)

» Starting PointBase

» Configuring PointBase in Sun Java System Enterprise Edition 8.1 2005Q1

» Stopping PointBase

» Executing SQL Statements with PointBase

» Registering JDBC Resources and Defining Connection Pools

Installing and Configuring PointBase Server (if not already installed)

PointBase is not installed when either the application server is installed as part of a Solaris 9 installation.

To determine if pointbase is installed and configured to work with sample applications, check your application server installation for the following directory:

<install_dir>/pointbase/

If PointBase exists in your application server installation, see the Starting PointBase section for details on starting the database server.

To install and configure PointBase for use with the sample applications, follow these steps:


1. Download and Install PointBase Server and Client Products

2. Update Sample Ant Files

3. Copy Samples PointBase Database Files

4. Add PointBase Type 4 JDBC[tm] Driver to Application Server's Classpath

1. Download and Install PointBase Server and Client Products

Download the PointBase evaluation software from http://www.pointbase.com.

Install at least the PointBase Server and Client products on your system. The Pointbase Client product includes the PointBase Type 4 JDBC driver.

2. Update Sample Ant Files

2 a. Edit the common.properties file under the <install_dir>/samples/ directory and set the com.sun.aas.pointbaseRoot property to the PointBase installation directory.

2 b. Next, edit the common.xml file under the <install_dir>/samples/ directory and ensure that the db.classpath property specifies the appropriate name and location of the PointBase tools and client JAR files.

For example, these JAR file are located under the lib/ directory of a PointBase 4.8 installation.

<!-- pointbase properties -->
<property name="db.driver" value="com.pointbase.jdbc.jdbcUniversalDriver"/>
<property name="db.root" value="${com.sun.aas.pointbaseRoot}"/>
<property name="db.url" value="jdbc:pointbase:server://localhost/sun-appserv-samples"/>
<property name="db.classpath" value="${db.root}/lib/pbtools.jar;${db.root}/lib/pbclient.jar"/>

3. Copy Samples PointBase Database Files

If you intend to share the PointBase installation with other users, then you will learn how to create your own PointBase runtime environment in the next section. If this is the case, then proceed to the next step to add the PointBase JDBC driver to your application server's classpath.

4. Add PointBase Type 4 JDBC Driver to Application Server's Classpath

Copy the PointBase Type 4 JDBC driver library from the PointBase installation directory (<pointbase_install_dir>)  to the lib/ directory of your application server instance. For example:

.../domains/domain1/lib/classes

You can find the JDBC driver under <pointbase_install_dir>/lib/. The driver is named pbclient.jar.

Restart the application server to make the server aware of the driver.

Alternatively, you can specify the location of the PointBase driver in the Classpath Suffix field in the application server's configuration. Start the administrative console and access the application server instance's JVM Settings -> Path Settings area to make this change.

Creating Your Own PointBase Runtime Environment (optional)

If you are either sharing your application server installation with other users or your system user ID does not have write permissions to the area in which PointBase is installed (which is typically the case when the application server is installed by the root user on UNIX systems and you are using a non-root user ID), you should make a copy of the pre-built PointBase databases and the PointBase Server startup script.

You can create your own copy of the PointBase Server environment by following these steps:

1. Create a directory named pointbase/ in your own area of the system.

2. Copy the the following files from the PointBase installation area to <personal_pointbase_dir>/pointbase/ directory:

Files Comments

startserver.sh or startserver.bat

Start up script containing port number on which the PointBase Server listens. Please edit the files, if you want to make any modifications.
pointbase.ini Initialization file specifying location of database files. Please edit the file, if you want to make any modifications.

If PointBase was installed as part of the application server installation, these files are located at:

<install_dir>/pointbase/tools/serveroption/

If you downloaded an installed the evaluation distribution of PointBase, these files are located at:

<pointbase_install_dir>/tools/server/

4. Edit the startserver.sh or startserver.bat script to specify a port number that does not conflict with other running instances of the PointBase Server.

Using a Non-default Port Number: If you change the port number on which the PointBase Server listens from the default value of 9092, you must modify the JDBC Connection Pool properties to reflect the non-default port number. Otherwise the application server will not be able to contact your copy of the PointBase Server.

The dataBaseName property specified for the JDBC Connection Pool must be changed from:

jdbc:pointbase:server://localhost/sun-appserv-samples

to:

jdbc:pointbase:server://localhost:<port>/sun-appserv-samples

Where <port> is the port number specified in the startserver script.

If you do not use the default port of 9092, then you should modify the pointbase.port property in the <install_dir>/samples/common.properties file.

Now you are ready to start the PointBase Server from your own directory area.

Starting PointBase

NOTE: If starting Pointbase on Sun Java System Enterprise Edition 8.1 2005Q1, be sure to see this note.

The database server can be easily started by performing one of the following actions:

Windows Platforms:

PointBase installed with the application server: <install_dir>\pointbase\tools\serveroption\startserver.sh

PointBase downloaded and installed separately: <pointbase_install_dir>/tools/serveroption/startserver.bat

UNIX Platforms:

PointBase installed with the application server: <install_dir>/pointbase/tools/serveroption/startserver.sh

PointBase downloaded and installed separately: <pointbase_install_dir>/tools/serveroption/startserver.sh

Alternatively, if you copied the PointBase Server files to your own directory, execute the startserver script from that location.

Once you execute the startup script, you will see the following text in either a command window or at the UNIX terminal prompt:

    Server started, listening on port 9092, display level: 0 ...
    >

To stop the server, enter quit at the > prompt.

Configuring PointBase in Sun Java System Enterprise Edition 8.1 2005Q1

Many sample applications use the PointBase database server included with the Application Server. When using Application Server Enterprise Edition, you must configure the PointBase database server before using it. There are two ways to configure PointBase:

  • Set the JAVA_HOME environment variable to the location of the J2SE. PointBase bundled with application server is only supported with J2SE 1.4.2.
  • Edit the Application Server's PointBase configuration file.

To use the first method:

  1. Make sure you have the J2SE installed that you want to use. Download J2SE 1.4.2 if you don't already have it.
  2. Using the command appropriate for your operating system and shell, set the JAVA_HOME environment variable to the directory where J2SE is installed. For example
    % setenv JAVA_HOME "/opt/SUNWappserver/jdk"

To use the second method, the procedure depends on the operating system.

Solaris and Linux

On Solaris and Linux, the configuration file is in install_dir/pointbase/tools/serveroption/pbenv.conf. Edit this file and change the line

PB_JAVA=%%%PB_JAVA%%%

to

PB_JAVA=JDK_location

where JDK_location is the directory where the J2SE is installed. If you installed J2SE with Application Server, it is installed by default to install_dir/jdk. After making this change, you can start PointBase using the startserver script.

Windows

On Windows, the configuation file is install_dir\pointbase\tools\serveroption\pbenv.bat. Edit this file and change the line
set PB_JAVA=%%%PB_JAVA%%%

to

set PB_JAVA=JDK_location
where JDK_location is the directory where the J2SE is installed. If you installed J2SE with Application Server, it is installed by default to install_dir\jdk.
After making this change, you can start PointBase by running startserver.bat.

Don't Need A Console Window? On UNIX, if you want to run the PointBase server in the background, you can edit the startserver.sh script and place the option "/noconsole" at the end of the command line.

.../java -classpath ./lib/pbembedded.jar;./lib/pbtools.jar com.pointbase.net.netServer /port:9092 /noconsole

The jar file pbembedded.jar and pbtools.jar are for PointBase 4.8 installation. You may have to use different jar file depending upon your PointBase installation.

Use "&" at the end of the startserver.sh command to run the server in the background.

./startserver.sh &
[1] 26418

See the PointBase server documentation in the following location for more information on starting and stopping the server:

<pointbase_install_dir>/docs/


Stopping PointBase

To stop the server, enter quit at the > prompt.

Executing SQL Statements with PointBase

The easiest means of performing these tasks is to use the PointBase Console GUI to execute SQL statements found in the .sql files within the src/sql/ directory of each sample application.

To start the Console, follow these instructions:

Windows Platforms:

PointBase installed with the application server: Execute <install_dir>\pointbase\tools\serveroption\startconsole.bat

PointBase downloaded and installed separately: <pointbase_install_dir>\tools\serveroption\startconsole.bat

UNIX Platforms:

PointBase installed with the application server: Execute <install_dir>/pointbase/tools/serveroption/startconsole.sh

PointBase downloaded and installed separately: <pointbase_install_dir>/tools/serveroption/startconsole.sh

The Console appears as follows:

To connect to the database, select DBA -> Connect to Database. (Note: Default user name and password for Pointbase is PBPUBLIC / PBPUBLIC)

Enter the following information for the samples database installed with the application server:

  • Driver: use the default value as provided.
  • URL: jdbc:pointbase:server://localhost/sun-appserv-samples
  • User and Password: use values as appropriate for the sample of interest:
Sample User Password
Java Pet Store petstore petstore
opc opc
supplier supplier
Smartticket 1.2 PBPUBLIC PBPUBLIC
Adventure Builder Reference Application v1.0
adventure
adventure

Once connected to the database, you can enter SQL statements in the top portion of the window and the results can be viewed in the lower portion. SQL statements can be entered individually or as a sequence of statements from a file.

If a single statement has to be executed, then enter the SQL statement and select the menu option SQL -> Execute to execute the statement.

If a sequence of statements is to be executed, use the menu option SQL -> Execute all.

To use a .sql file, as provided with the sample applications, select File -> Open and open the .sql file of interest. If the .sql file contains an exit; statement, you should remove this statement to avoid exiting from the Console when executing statements read from the .sql file.

Review the PointBase documentation for more information on the PointBase console. The documentation is available at <pointbase_install_dir>/docs/.

Registering JDBC Resources and Defining Connection Pools

Refer to the Getting Started Guide for details on defining JDBC Connecton Pools for PointBase through the application server's administrative console.

As an advanced topic, you can reveiw the samples common.xml and build.xml files to learn how to use the asadmin command line interface (CLI) to define JDBC resources and connection pools.