Sun Microsystems Logo




Sun Java (tm) System Application Server 7 Samples
Using PointBase with the Samples
 
Sun Java (tm) System Application Server 7 Enterprise Edition does not include PointBase even though PointBase Network Server version 4.2 database was part of the installable components for the Sun Java (tm) System Application Server 7 Platform Edition. 

This document describes several aspects of working with the PointBase server and Sun Java (tm) System Application Server 7:
 
  » Installing and Configuring PointBase Server 
  » Starting PointBase
  » Stopping PointBase
  » Executing SQL Statements with PointBase
  » Registering JDBC Resources and Defining Connection Pools

Installing and Configuring PointBase 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. 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. The previous Sun Java (tm) System Application Server 7 Platform Edition release included PointBase Network Server version 4.2, therefore the version number mentions in this document is 4.2 and most of samples that were part of Platform Edition release configured to use PointBase 4.2 by default. You should make any changes as needed to the version of PointBase that you are using.

2. Update Sample Ant Files

2 a. Edit the common.properties file under the <appserver_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 <appserver_install_dir>/samples/ directory and modify the db.classpath property to specify the appropriate name and location of the PointBase tools and client JAR files. 

In the following section of the common.xml file, replace the client_tools/ subdirectory with the name of the subdirectory under which the tools and client JAR files reside and modify the name of the JAR files as appropriate:

<!-- 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}/client_tools/lib/pbtools42RE.jar;${db.root}/client_tools/lib/pbclient42RE.jar"/>
For example, these JAR file are located under the lib/ directory of a PointBase 4.3 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/pbtools43.jar;${db.root}/lib/pbclient43.jar"/>
3. Add PointBase Type 4 JDBC Driver to Server Application Server's Classpath

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

.../domains/domain1/server1/lib/
You can find the JDBC driver under <pointbase_install_dir>/lib/. The driver is named pbclientnn.jar where nn represents the version of PointBase.

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. 
 

Starting PointBase

To start database server, run script:

<pointbase_install_dir>/server/startserver.sh

Once you execute the startup script, you will see the following text in a terminal window prompt: 

    Server started, listening on port 9092, display level: 0 ...
    >
Don't Need A Console Window? 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/pbserver42RE.jar com.pointbase.net.netServer /port:9092 /noconsole
The jar file pbserver42RE.jar is for PointBase 4.2 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

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:

Execute  <pointbase_install_dir>/client_tools/PB_console.sh
This dialog will appear on top of the Console window:


 

Connect to the existing default database as follows:

  • Driver: use the default value as provided
  • URL: jdbc:pointbase://localhost/sample
  • User and Password: PBPUBLIC
  • OR
    Create new database for running sample application with the following information:
  • Driver: use the default value as provided
  • URL: jdbc:pointbase://localhost/sun-appserv-samples
  • User and Password: use values as appropriate for each sample
  • 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 db.port property in the common.xml file.

    After connecting, the Console appears as follows: 
     
    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 Developer's Guide to J2EE Services and APIs for details on defining JDBC Connection Pools for PointBase through the application server's administrative console. 

    As an advanced topic, you can review 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.