sun.com | How To Buy | My Sun | Worldwide Sites

Sun[tm] ONE Web Server Samples
Using PointBase with the Samples

This document describes several aspects of working with the PointBase server and Sun ONE Web Server. (For database-related information, please refer to PointBase documentation.)
| » Installing and Configuring the JDBC driver
| » Starting and Stopping PointBase
| » Creating a database with PointBase
| » Executing SQL Statements with PointBase
| » Registering JDBC Resources and Defining Connection Pools
## Installing and Configuring the JDBC driver To install and configure PointBase for use with the sample applications, follow these steps:
| 1. Download and Install PointBase Server and Client Products
| 2. Add PointBase Type 4 JDBC[tm] Driver to Web 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. Add PointBase Type 4 JDBC Driver to the Web Server's Classpath Open the server.xml file of the web server instance. Add the location of the PointBase driver in the classpathsuffix. You can find the JDBC driver under <pointbase_install_dir>/lib/. The driver is named pbclientnn.jar where nn represents the version of PointBase. For example, check the following sample JAVA element (with /pointbase/lib/pbclient46.jar as the <PointBase JDBC driver>):
    Change it from this:

    <JAVA javahome="/ws61/bin/https/jdk" serverclasspath="/ws61/bin/https/jar/webserv-rt.jar:
    ${java.home}/lib/tools.jar:/ws61/bin/https/jar/webserv-ext.jar:/ws61/bin/https/jar/webserv-jstl.jar:
    /ws61/bin/https/jar/ktsearch.jar" classpathsuffix="" envclasspathignored="on" debug="false"
    debugoptions="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n" dynamicreloadinterval="2">
    ........
    ........
    </JAVA>

    to this:

    <JAVA javahome="/ws61/bin/https/jdk" serverclasspath="/ws61/bin/https/jar/webserv-rt.jar:${java.home}/lib/tools.jar:
    /ws61/bin/https/jar/webserv-ext.jar:/ws61/bin/https/jar/webserv-jstl.jar:
    /ws61/bin/https/jar/ktsearch.jar" classpathsuffix="/pointbase/lib/pbclient46.jar"
    envclasspathignored="on" debug="false"
    debugoptions="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n" dynamicreloadinterval="2">
    ........
    ........
    </JAVA>
Restart the web server to make the server aware of the driver. ## Starting PointBase The database server can be easily started by performing one of the following actions. See the PointBase server documentation for more detailed information about starting and stopping the server. On Windows platforms: <pointbase_install_dir>/tools/server/startserver.bat On UNIX platforms: <pointbase_install_dir>/tools/server/startserver.sh ## Creating a Database with PointBase After starting the PointBase console, select DBA -> Create New Database. While creating the database, you can use the existing PointBase user PBPUBLIC, or you can use the existing user. ## Executing SQL Statements with PointBase You can use the PointBase console GUI to execute SQL statements found in the .sql files within the src/sql/ directory of each JDBC-relevant sample. To start the console, do the following: On Windows platforms: <pointbase_install_dir>\tools\server\startconsole.bat On UNIX platforms: <pointbase_install_dir>/tools/server/startconsole.sh To connect to the database, select DBA -> Connect to Database. Enter the following information for the samples database installed with the web server: Driver: use the default value as provided URL: jdbc:pointbase://localhost/<database name> User and Password: user name and password for the database 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 must be executed, enter the SQL statement and select the menu option SQL -> Execute to execute the statement. If a sequence of statements must 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 about the PointBase console. The documentation is available at: <pointbase_install_dir>/docs ## Registering JDBC Resources and Defining Connection Pools You can reveiw the sample common.xml and build.xml files to learn how to use the ant command-line interface (CLI) to define JDBC resources and connection pools. Also refer to the following: (1) Using Ant with the Samples (2) Deploying Samples and Creating the Resources using Admin GUI

Company Info | Contact | Copyright 2003 Sun Microsystems