HP Driver for JDBC User’s Manual HP 3000 MPE/iX Computer Systems Edition 1 Manufacturing Part Number: 36216-90217 E0399 U.S.A.
Notice The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or for direct, indirect, special, incidental or consequential damages in connection with the furnishing or use of this material.
Contents 1. Introduction JDBC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 HP JDBC Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2. Requirements Java Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . HP-UX Server Requirements. . . . . . . . . . . . . . .
Contents 6. Troubleshooting Connection Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 Client Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56 Server Logging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60 A. Data Types ALLBASE/SQL Data Types . . . . . . . . . . .
Figures Figure 1-1. JDBC Client-Server Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Figures 6
Tables Table 5-1. Data Type Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Table 5-2. Data Type Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Table 5-3. Unsupported Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tables 8
Preface Java Database Connectivity (JDBC) is a standard Application Programming Interface (API) for database access from Java. HP Driver for JDBC is an implementation of the standard JDBC API. It consists of Hewlett Paclard’s fully-java Driver for JDBC, network protocol and database server interface components for concurrent access to IMAGE/SQL and ALLBASE/SQL databases This manual provides information about installing, configuring and using HP Driver and server components for JDBC.
1 Introduction Java Database Connectivity (JDBC) is a Java API that enables development of Java applications and applets with a wide range of relational databases. It consists of a set of classes and interfaces written in Java. JDBC allows developers to write database applications using a standard, pure Java API.
Introduction JDBC JDBC A typical JDBC Java application consists of a Java application or applet, the JDBC Driver Manager, a vendor specific JDBC driver, and a database. The JDBC Driver Manager is provided with the Java SDK and its primary function is to load and register the vendor-specific JDBC driver with the Java applications and then get out of the way. The following diagram shows the various components of a client-server JDBC application.
Introduction HP JDBC Components HP JDBC Components There are three components supplied with the HP JDBC product, the JDBC Driver, the JDBC Monitor, and the JDBC Server. The user is responsible for writing a Java application or applet that uses JDBC on the client, as well as providing the ALLBASE/SQL or IMAGE/SQL database on the server. The HP Driver for JDBC is a set of Java classes that implement the java.sql.
Introduction HP JDBC Components 14 Chapter 1
2 Requirements HP Driver for JDBC can be used to access ALLBASE/SQL or IMAGE/SQL from Java Clients running under various operating systems. This chapter specifies Java Client, Database Server and Operating System requirements for successfully installing and running HP Driver for JDBC.
Requirements Java Requirements Java Requirements The HP JDBC Client components (the JDBC driver itself) requires a Sun-compliant JDK version 1.1 and above, which includes a JDBC version 1.2. Install the JDK from Sun or from your platform vendor. Individual platform vendors may have their own requirements for the platform host. For example, Java only runs on HP-UX 10.20 and MPE/iX 6.0 and above; HP-UX 9.x and MPE/iX 5.5 are not supported.
Requirements HP-UX Server Requirements HP-UX Server Requirements The HP JDBC Server components require HP-UX version 10.20 or greater. HP-UX components are required only if your JDBC Server platform is the HP-UX operating system.
Requirements MPE/iX Server Requirements MPE/iX Server Requirements The HP JDBC Server components require MPE/iX version 6.0 or greater. MPE/iX components are only required if your JDBC Server platform is the MPE/iX operating system.
Requirements ALLBASE/SQL or IMAGE/SQL Requirements ALLBASE/SQL or IMAGE/SQL Requirements The HP JDBC Server components require an ALLBASE/SQL G3.01 or IMAGE/SQL G3.00 or greater.
Requirements ALLBASE/SQL or IMAGE/SQL Requirements 20 Chapter 2
3 Installation This chapter takes you through the step-by-step process of installing and configuring HP Driver for JDBC and its server components.
Installation HP-UX Server Components HP-UX Server Components The installation of the JDBC Server components must be done by a system administrator who has “root” capability on the server host where the database resides. A temporary directory, /tmp/jdbc, is used to stage the installation scripts, and product tar file. The server components are distributed as a UNIX tape archive (TAR) file, hpjdbc_XXX.tar, where XXX represents the release number of the product.
Installation MPE/iX Server Components MPE/iX Server Components The installation of the HP JDBC product must be done by a system administrator on the server host where the database resides.. The components of HP JDBC are distributed as an archive file, HFSFILES.JDBC.SYS. Stream the JDBC installation job I00IJDBC, to perform the actual installation: :stream I00IJDBC.JDBC.SYS The installation script will extract the server files and client archive files and set up the JDBC monitor startup scripts.
Installation Java Client Components Java Client Components The HP JDBC product must first be installed on the server host before the client can be installed. This is because the client files are bundled with the server product. The HP Driver for JDBC components consist of the Driver Java class files and a sample JDBC client source file. These are the only components required on the client-side.
Installation Java Client Components For the HP 9000 server, use any login as the username: From your client platform: ftp hpux-server >binary >get /opt/allbase/jdbc/driver.tar /* or driver.jar or driver.zip */ Using Reflection Software See the software description on how to transfer the appropriate file (transfer the file in binary mode).
Installation Java Client Components Example on HP 3000 CLASSPATH=/usr/local/java/latest/lib:. In order to use the HP Driver for JDBC client on the MPE/iX system, you need to have the JAVA/iX installed. JAVA/iX is shipped with MPE/iX starting in Release 6.0. The following sub-directories for the Driver class files should be automatically created: com/hp/jdbc/allbase com/hp/jdbc/allbase/samples For a complete list of the files that are installed, please refer to Appendix E , “HP ALLBASE/SQL JDBC File Lists.
Installation Configuring HP JDBC Server Configuring HP JDBC Server The HP JDBC Server components behave the same on both the HP-UX and MPE/iX platforms. Thus both the configuration file and log file are the same (except for filenames). The following example shows the standard HP JDBC default server configuration file, servcfg. This is a text file that resides on the server host in the same directory as the HP JDBC Server executable files and can be used to alter some of the server’s behavior.
Installation Configuring HP JDBC Server The server configuration file is read in anew each time a new server process is started. Thus once the file is edited and saved, the changes will take place beginning with the next server process. If logging is turned on in this file, it will be in effect for all subsequent server processes. For a complete listings of JDBC Server log file, please refer to Appendix C , “HP JDBC Server.
Installation Starting and Stopping HP JDBC Monitor Starting and Stopping HP JDBC Monitor HP JDBC Monitor is the server-side counterpart of HP Driver for JDBC, present on the client-side. For a JDBC application to connect to a database, the JDBC Monitor must be running on the database server. JDBC Monitor can be started manually or automatically at system startup by including the JDBC Monitor start commands in the system startup scripts.
Installation Starting and Stopping HP JDBC Monitor MPE/iX Monitor Startup and Shutdown The startup and shutdown of the MPE/iX HP JDBC Monitor is normally done by the startup and shutdown stream jobs, JSTRTMON and JSTOPMON, which are normally included in MPE/iX system startup and shutdown scripts. Thus as long as the machine is up and running, the JDBC Monitor will also be up. The only time the monitor should ever be brought down is to install a newer version.
4 Using the HP Driver for JDBC This chapter describes how to use HP Driver for JDBC from Java Programs. Information about setting up environment variables, compiling Java programs, loading the HP Driver for JDBC, and connecting to a database is provided.
Using the HP Driver for JDBC Java Class Path Java Class Path Before the HP Driver for JDBC can be used, the Java class path must be set to include the HP Driver for JDBC class files. Without this setting, both the Java compiler and the Java Run Time Environment will not be able to locate the HP Driver for JDBC. Please refer to your JDK documentation for more explicit details as to how to set the Java class path.
Using the HP Driver for JDBC Sample JDBC Client Sample JDBC Client The HP Driver for JDBC comes with the source code to two JDBC applications, a sample client and a simple client. Both can be used to test the installation of JDBC components on the client and server. The simple client is called SimpleClient and is a bare-bones text-based application that makes a connection to an ALLBASE/SQL or IMAGE/SQL database, and allows the user to send SQL statements and retrieve the results.
Using the HP Driver for JDBC Sample JDBC Client The -w command line switch will cause the sample client to display a Java dialog box to accept user input of the connection information. Normally the sample client uses text-mode input, which displays the user password on the screen. The -t command line switch will cause the application to turn on client-side tracing and prompt the user for the trace flags and the trace output filename.
Using the HP Driver for JDBC Loading the HP Driver for JDBC Loading the HP Driver for JDBC The Java method that is used to load all JDBC drivers is the class.forName method. To load the HP Driver for JDBC, the code is: class.forName(“com.hp.jdbc.allbase.JdbcDriver”); This loads the HP Driver for JDBC and registers it with the JDBC Driver Manager. Once a driver has been loaded and registered with the Driver Manager, it is ready to be used to connect to a database.
Using the HP Driver for JDBC Connection Parameters Connection Parameters The following information is required for all HP JDBC connections to an ALLBASE/SQL or IMAGE/SQL database: Host name — The name of the server host on which the ALLBASE/SQL or IMAGE/SQL database and JDBC Monitor is running. This can either be the name of the server host, or the IP address. For example, 'myserv.mycomp.com' or '20.45.12.122'. Port number — The port number on which the JDBC Monitor is listening.
Using the HP Driver for JDBC Connection Parameters Once these values have been determined, the JDBC Driver connection URL can be synthesized. There are two primary JDBC Driver class methods that can be used to connect to the database. The first one requires that all connection parameters be provided in a Java String URL, including the user name and password. However, this information can be logged on the client, thus recording the user name and password.
Using the HP Driver for JDBC URL Syntax (Including User Name and Password) URL Syntax (Including User Name and Password) The first connection method specifies all connection parameters in a URL string including the user name and password. java.sql.DriverManager.getConnection(url) where: String url = “jdbc:allbase://host[:port]/database?UID=uid&PWD=pwd” “[&TRACE=trace]”; NOTE host Name or IP address of the sever host. port Optional port number on which the JDBC Monitor is listening.
Using the HP Driver for JDBC URL Syntax (Without User Name and Password) URL Syntax (Without User Name and Password) The second connection method specifies the user id and password as method arguments, so this information is not present in the URL. java.sql.DriverManager.
Using the HP Driver for JDBC HP-UX Userid and Password HP-UX Userid and Password For the JDBC Monitor on HP-UX, the userid and password in the client URL connection string must correspond to a valid HP-UX user name and password for the server host. However, the user accounts may be configured to not allow shell logons, to prevent someone from using the user name and password to actually log on to the server host.
Using the HP Driver for JDBC MPE/iX Userid and Password MPE/iX Userid and Password The MPE/iX operating system supports user names, account names, group names, and session names. There are also user passwords, account passwords, and group passwords. Various combinations of these names and passwords are supported by the MPE/iX JDBC Monitor for user validation. The format for the MPE/iX userid is: [sessionname,]username.accountname[,groupname] The group and session names are optional.
Using the HP Driver for JDBC MPE/iX Userid and Password 42 Chapter 4
5 ALLBASE/SQL Specifics This chapter describes details specific to HP Driver for JDBC and ALLBASE/SQL. Data type mapping, data type conversions, unsupported data types, unsupported SQL statements and support for stored procedures are discussed.
ALLBASE/SQL Specifics ALLBASE/SQL to JDBC Data Type Mapping ALLBASE/SQL to JDBC Data Type Mapping Table 5-1 shows what the HP Driver for JDBC will report as the JDBC data type for each ALLBASE/SQL data type. These are the java.sql.Types values that will be returned from the java.sql.ResultSetMetaData.getColumnType method. An “X” in the column indicates the data type mapping. A description of each ALLBASE/SQL and JDBC data type can be found in Appendix A , “Data Types.
ALLBASE/SQL Specifics ALLBASE/SQL to JDBC Data Type Conversions ALLBASE/SQL to JDBC Data Type Conversions Table 5-2 shows the supported data type conversions between ALLBASE/SQL and JDBC. For conversions from JDBC to Java, please refer to a JDBC book or the Java JDBC documentation. Those conversions are generic to all JDBC Drivers. A description of each ALLBASE/SQL and JDBC data type can be found in Appendix A , “Data Types.” Suggested conversions are denoted by a capital letter “X” in the conversion grid.
ALLBASE/SQL Specifics ALLBASE/SQL to JDBC Data Type Conversions The conversion of any ALLBASE/SQL data type to the java.sql.Types.BIT data type is such that only the value of zero, in either numeric or character format, will be converted to the java.sql.Types.BIT value of 0. All other values will be converted to the java.sql.Types.BIT value of 1. Thus only the integer value 0, the floating-point value 0.0, the decimal value 0 (not 0.0), and the character string “0” will be converted to a bit value of 0.
ALLBASE/SQL Specifics Unsupported ALLBASE/SQL Data Types Unsupported ALLBASE/SQL Data Types The ALLBASE LONG BINARY, and LONG VARBINARY data types are currently not supported by the HP Driver for JDBC.
ALLBASE/SQL Specifics Acceptable SQL Syntax Acceptable SQL Syntax The HP JDBC Server will accept either ODBC SQL statement syntax, or ALLBASE/SQL statement syntax. All SQL statements are first parsed for ODBC 2.0 SQL syntax. If the statement conforms to the ODBC 2.0 SQL syntax, it is translated to ALLBASE/SQL before being passed to the ALLBASE/SQL DBMS. If the statement does not conform to the ODBC 2.
ALLBASE/SQL Specifics Unsupported ALLBASE/SQL SQL Statements Unsupported ALLBASE/SQL SQL Statements Table 5-3 shows a list of unsupported ALLBASE/SQL statement types in HP JDBC. Note that, in many cases, JDBC provides a standardized method of performing the same action. For example, the ALLBASE/SQL “COMMIT WORK” statement is not supported, since the user should be using the java.sql.Connection.commit method.
ALLBASE/SQL Specifics Dynamic/Parameterized SQL Statements Dynamic/Parameterized SQL Statements The HP Driver for JDBC supports the use of parameterized SQL statements through the java.sql.PreparedStatement interface. The SQL statements must use a question mark (?) as the marker character for passing the parameters.
ALLBASE/SQL Specifics Stored Procedures Stored Procedures The HP Driver for JDBC supports the following types of ALLBASE/SQL stored procedures through the java.sql.CallableStatement interface: 1. Procedures that return one or more result sets. 2. Procedures that take one or more input arguments. 3. Procedures that return one or more output arguments. 4. Procedures that have a return status value.
ALLBASE/SQL Specifics Stored Procedures 52 Chapter 5
6 Troubleshooting This chapter lists most frequently encountered problems in using HP Driver for JDBC and how to overcome them. Ways to enable client tracing and server logging to identify problems are also given.
Troubleshooting Connection Process Connection Process Most problems arise during the initial connection of the JDBC client to the database. For this reason, we shall first completely describe the steps that occur during the connection process, and mention some common problems that can arise. Step 1. Loading the HP Driver for JDBC Class Files • If this step fails, the most likely cause is that the Java CLASSPATH environment variable has not been set correctly.
Troubleshooting Connection Process Step 7. Switching to the Effective User • Once the process is spawned, the monitor switches the effective user id to the user that was supplied in the user validation. This ensures that the user only has the privileges assigned to the user. If this step fails, the most likely cause is that the monitor was not started by “root,” the superuser for HP-UX, or a user with the PM capabilities for MPE/iX.
Troubleshooting Client Tracing Client Tracing Tracing of the JDBC Driver client class files is invoked by adding tracing commands to the connection URL. The connection URL can be altered to both invoke tracing, and to control the type of information that is traced. The tracing information is sent to a Java stream, which must be specified by the application using the java.sql.DriverManager.setLogStream method. Both the tracing level and tracing output must be specified before any tracing can be done.
Troubleshooting Client Tracing TIMESTAMP Include both the date and the time on all tracing output lines. This is just a combination of the DATE and TIME tracing values. OBJECT Include the object hash code in the format HHHHHHHH on all tracing output lines where HHHHHHHH is the eight digit hexadecimal value of the hash code. This information appears in the first column of the tracing output. THREAD Include the executing thread name on all tracing output lines.
Troubleshooting Client Tracing Here is a sample output of a JDBC trace log using the trace flag ALL: 0f457ce2 19980917 110116.300 main JdbcConnection.createStatement(void) 0f457ce2 19980917 110116.312 main JdbcConnection.createStatement() = JdbcStatement@0f458ef4 0f458df3 19980917 110116.903 main JdbcResultSet.new(SolidResultSet@0f458e9b) 0f458df3 19980917 110116.907 main JdbcResultSet.new() = JdbcResultSet@0f458df3 0f458df3 19980917 110117.088 main JdbcResultSet.getMetaData(void) 0f458df3 19980917 110117.
Troubleshooting Client Tracing The first column shows the object hash code. Note that the object hash code can be matched with the objects returned by various methods. The second column shows the date, September 17, 1998. The third column shows the time, 11:01 AM. The fourth column shows the thread name; in this case there is only the main thread. The last column contains the tracing information. In each line, the class and method are logged.
Troubleshooting Server Logging Server Logging The server configuration file controls logging of the JDBC Server, see “Configuring HP JDBC Server” in Chapter 3 , “Installation,” or “HP JDBC Server Configuration Files” in Appendix C , “HP JDBC Server.” The following is a list of the various logging levels that can be set in the server configuration file. NONE Turns off all preceding logging levels.
A Data Types This appendix gives a detailed description of Data Types supported by ALLBASE/SQL and HP Driver for JDBC. Data type names, size and format are discussed.
Data Types ALLBASE/SQL Data Types ALLBASE/SQL Data Types SMALLINT 16-bit signed integer. INTEGER 32-bit signed integer. NUMERIC Fixed-point, packed, decimal number with a specified precision of p and scale of s, where p is in the range 1 to 27, and s is in the range 0 to p. The default value of p is 27 and s is 0. DECIMAL Identical to NUMERIC. REAL 32-bit floating-point number. FLOAT A floating-point number with a precision of p where p is in the range 1 to 53. The default value of p is 53.
Data Types ALLBASE/SQL Data Types DATETIME String of characters in the format “YYYY-MM-DD HH:MI:SS.FFF” where YYYY represents the calendar year, MM is the month, DD is the day of the month, HH is the hour, MI is the minute, SS is the second, and FFF is the thousandth of a second. DATETIME is in the range “0000-01-01 00:00:00.000” to “9999-12-31 23:59:59.999”. INTERVAL String of characters in the format “DDDDDDD HH:MI:SS.
Data Types JDBC Data Types JDBC Data Types CHAR Small, fixed-length character string. VARCHAR Small, variable-length character string. LONGVARCHAR Large, variable-length character string. NUMERIC Fixed-precision decimal value represented with a precision that can be greater than the original precision. DECIMAL Fixed-precision decimal value represented with a precision that is no greater than the original precision. BIT A single bit value that can be either zero or one.
B JDBC Monitor This appendix describes one of the HP JDBC Server components, the JDBC Monitor. JDBC Monitor configuration, logging, startup and shutdown are discussed.
JDBC Monitor HP-UX Monitor HP-UX Monitor On the HP-UX platform, a separate server-process services each client connection. These processes are dissociated from the monitor process, so if the monitor terminates or dies, the existing server-processes servicing client requests will continue to function, until the client closes the connection, or the server times out. Normally, the monitor is automatically started up during the host boot process via a startup script.
JDBC Monitor MPE/iX Monitor MPE/iX Monitor On the MPE/iX platform, each client connection is serviced by a separate process that is in the same session as the monitor. Thus, if the monitor is terminated or dies, the existing server process already serving the client requests will also die. This could result in client applications experiencing dropped connections.
JDBC Monitor HP-UX Monitor Configuration File HP-UX Monitor Configuration File This represents the standard HP-UX JDBC monitor configuration file. This is a text file that resides on the server host in the same directory as the monitor executable file and can be used to alter some of the monitor’s behavior. The name of the monitor configuration file is moncfg, and it is located in /opt/allbase/jdbc/bin. MLOGPATH /opt/allbase/jdbc/logs MAXLOGSIZE 500000 MAXSESSIONS 128 [JDBCSERV.JDBC.
JDBC Monitor HP-UX Monitor Configuration File Normally, there is no reason to edit the monitor configuration file. If for some reason it is edited, the monitor must be reset using the monctrl command to trigger the monitor to re-read the configuration file. The syntax for this command is: monctrl reset [portnumber] where portnumber is the port number on which the monitor to be reset is running. If the port number is not specified, the default port number is assumed.
JDBC Monitor HP-UX Monitor Log HP-UX Monitor Log This is a sample of an HP-UX JDBC monitor log file. The beginning of the file shows when the monitor was started, as well as the monitor configuration settings. The left-hand column shows the UNIX process id number (PID) of the process that is logging the information.
JDBC Monitor HP-UX Monitor Log The sample log file shows three client connections. For each connection, the client IP address is logged, along with the time of the connection. If there the user validation fails, the cause of the failure is logged (note the “E” in the second column denoting an error condition). If the user validation succeeds, the connection to the JDBC Server is logged.
JDBC Monitor MPE/iX Monitor Log MPE/iX Monitor Log This is a sample of a standard list spool file for the MPE/iX HP JDBC. The beginning of the file shows when the monitor was started. JOB JDBCMON,MGR.JDBC,JDBC. Priority = DS; Inpri = 8; Time = UNLIMITED seconds. Job number = #j586. FRI, OCT 9, 1998, 10:52 AM. HP3000 Release: C.50.00 MPE/iX HP31900 B.79.06 User Version: C.50.00 Copyright Hewlett-Packard 1987. All rights reserved. STREAMED BY STREAMER,MANAGER.
JDBC Monitor MPE/iX Monitor Log password specified. Waiting for a client connection... Connection established from 15.0.121.172 on FRI, OCT 9, 1998, 10:55 AM Unable to validate ID 'mgr.jdbc' - AIFCHANGELOGON() rc=-2521: Invalid user pas sword specified. Waiting for a client connection... Connection established from 15.0.121.172 on FRI, OCT 9, 1998, 11:00 AM Server 'servprog;info=""' created for userid 'mgr.jdbc' PIN=1914 Waiting for a client connection... Connection established from 15.0.121.
JDBC Monitor HP-UX Monitor Startup and Shutdown HP-UX Monitor Startup and Shutdown The startup and shutdown of the HP-UX JDBC Monitor is normally controlled by the system startup and shutdown scripts. Thus as long as the machine is up and running, the JDBC Monitor will also be up. The only time the monitor should ever be brought down is to install a newer version. In this case, use the monctrl command to kill the monitor process.
JDBC Monitor MPE/iX Monitor Startup and Shutdown MPE/iX Monitor Startup and Shutdown The startup and shutdown of the MPE/iX HP JDBC Monitor is normally done by the startup and shutdown stream jobs, JSTRTMON and JSTOPMON, which are included in system startup and shutdown scripts. Thus as long as the machine is up and running, the JDBC Monitor will also be up. The only time the monitor should ever be brought down is to install a newer version.
JDBC Monitor MPE/iX Monitor Startup and Shutdown 76 Appendix B
C HP JDBC Server This appendix discusses the HP JDBC Server components, the JDBC Monitor. Unlike the HP JDBC Monitor, the HP JDBC Server components behave the same on both the HP-UX and MPE/iX platforms. Thus both the configuration file and log file are the same (except for filenames).
HP JDBC Server HP JDBC Server Configuration File HP JDBC Server Configuration File The following example shows the standard HP JDBC Default Server configuration file. This is a text file that resides on the server host in the same directory as the HP JDBC Server executable files and can be used to alter some of the server’s behavior. On HP-UX the name of the default server configuration file is servcfg, and it is located in /opt/allbase/jdbc/bin.
HP JDBC Server HP JDBC Server Configuration File The next set of lines are the LOGGING levels used to determine the type of information to be logged to the server log file. The meanings of the various logging levels is discussed in the Troubleshooting section, under Server Logging. The logging levels can be turned on and off by either commenting the line out, or uncommenting the line. If the last line is LOGGING NONE, and the line is not commented out, all logging is turned off.
HP JDBC Server JDBC Server Logs JDBC Server Logs This is a sample of a JDBC Server log file. This log file was generated using the LOGGING CONNECTION, LOGGING IN, and LOGGING TIMESTAMP logging levels set in the server configuration file. 17039 [12:26:14.152] Connected to SOLID DM on Wed Oct 7 12:26:14 17039 [12:26:14.156] Connected from '15.0.121.172' by '' 17039 [12:26:14.243] TID: 'SET_LIB_OPTIONS' 17039 [12:26:14.443] TID: 'CONNECT' 17039 [12:26:14.
Simple Client Source Code D The Java source listing given in this appendix is a program demonstrating the use of HP Driver for JDBC to access an ALLBASE/SQL or IMAGE/SQL database. It can be run from any platform which has JDK 1.1 (or above) and HP Driver for JDBC installed. This program is part of the HP Driver for JDBC distribution and it is named SimpleClient.java.
Simple Client Source Code { /* User input fields */ String hostName = getString("Host Name: "); String userName = getString("User Name: "); String userPassword = getString("User Password: "); String dbName = getString("Database Name: "); /* Create the URL based on the user input */ String url = "jdbc:allbase://" + hostName + "/" + dbName + "?"; /* Try to make the connection to the database */ try { /* Load the jdbc driver */ Class.forName("com.hp.jdbc.allbase.
Simple Client Source Code e.printStackTrace(); System.exit(0); } /* Main loop */ String sql = null; ResultSet rs = null; while (true) { /* Ask user for an sql statement */ System.out.println(""); sql = getString("SQL -> "); System.out.println(""); /* If empty string, then exit */ if (sql == null || sql.length() == 0) break; /* Submit the sql statement */ try { stmt = con.createStatement(); /* If execute returns true, there is a result set */ if (stmt.execute(sql)) { rs = stmt.
Simple Client Source Code } catch (SQLException ex) { printException(ex); } catch (java.lang.Exception ex) { ex.printStackTrace(); } try { rs.close(); stmt.close(); rs = null; stmt = null; } catch (Exception e) {} } /* End of main loop */ try { con.close(); } catch (Exception e) {} System.exit(0); } /** * Print out SQLException information. */ private static void printException(SQLException e) { SQLException ex = e; System.out.println("SQLException:"); while (ex != null) { System.out.
Simple Client Source Code System.out.println(" Vendor code: " + ex.getErrorCode()); System.out.println(" Message : " + ex.getMessage()); ex = ex.getNextException(); System.out.println(); } return; } /** * Displays all columns and rows in the given result set */ private static void displayResultSet (ResultSet rs) throws SQLException { int i; /* Get the ResultSetMetaData. This will be used for ** the column headings. */ ResultSetMetaData rsmd = rs.
Simple Client Source Code } System.out.println("\n"); /* Print out the data, fetching until end of the result set */ String colValue; while (rs.next()) { /* For each column, print out the data as String */ for (i=1; i<=numCols; i++) { colValue = rs.getString(i); /* If data was null, use the null string instead */ if (rs.wasNull()) colValue = ""; System.out.print(colValue); /* Print separator */ if (i < numCols) System.out.print(", "); } System.out.
Simple Client Source Code */ private static String getString(String prompt) { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); if (prompt != null) System.out.print(prompt); String rString = ""; try { rString = in.
Simple Client Source Code 88 Appendix D
E HP ALLBASE/SQL JDBC File Lists This appendix lists each file that is provided in the HP JDBC product and gives a brief description of the purpose of the file.
HP ALLBASE/SQL JDBC File Lists Java Client Files Java Client Files In the com/hp/jdbc/allbase directory: Jdbc.class Parent JDBC Driver class JdbcCallableStatement.class JDBC callable statement implementation class JdbcConnection.class JDBC connection implementation class JdbcDatabaseMetaData.class JDBC database metadata implementation class JdbcDBMD.class JDBC database metadata utility class JdbcDriver.class JDBC Driver implementation class JdbcPreparedStatement.
HP ALLBASE/SQL JDBC File Lists Java Client Files In the com/hp/jdbc/allbase/samples directory: README JDBC sample client readme file SampleClient.java JDBC sample client source code SimpleClient.
HP ALLBASE/SQL JDBC File Lists HP-UX Server Files HP-UX Server Files In the /opt/allbase/jdbc directory: bin/jdbcmon JDBC Monitor executable program bin/moncfg JDBC Monitor text configuration file bin/monctrl JDBC Monitor control file bin/jdbcserv JDBC Server executable program bin/servcfg JDBC Server text configuration file logs/monlog JDBC Monitor log file logs/servlog JDBC Server default log file driver/driver.tar JDBC Driver files in UNIX tape archive format driver/driver.
HP ALLBASE/SQL JDBC File Lists MPE/iX Server Files MPE/iX Server Files In JDBC.
HP ALLBASE/SQL JDBC File Lists MPE/iX Server Files 94 Appendix E
Index A ABORTJOB command, 30 acceptable SQL, 48 ALLBASE SQL, 13 ALLBASE/SQL, 36 ALLBASE/SQL database, 12 applet, 13 archive file, 24 C child processes, 29 class files, 32 CLASSPATH, 32, 33 -classpath, 33 CLASSPATH environment, 33 Client Components Java, 24 client components Java class files, 24 sample source file, 24 client files, 24 client tracing, 56 client-server application, 12 client-side tracing, 34 common problems connection process, 54 components, 16 configuration option LOGFILE, 27 TIMEOUT, 27 Con
Index Java Client Components, 24 Java compiler, 32, 33 Java compiler option -classpath, 33 Java components, 16 Java dialog box, 34 Java Requirements, 16 Java Run Time Environment, 32 Java SDK, 12, 33 Java String URL, 37 Java Virtual Machine, 33 Java Virtual Machines, 12 Java VM rules, 46 JAVA/iX, 26 JDBC Driver Manager, 12 Java application, 12 JDBC API, 12, 13 JDBC client-server application, 12 JDBC Driver, 13 JDBC Driver Manager, 12, 35 JDBC Monitor, 13, 29 shutdown, 29 startup, 29 JDBC Server, 13 JDBC se
Index space characters, 57 Starting HP JDBC Monitor, 29 startup, 29 startup command, 36 startup script, 23 startup scripts, 22 Stopping HP JDBC Monitor, 29 stored procedures, 51 stream jobs, 30 JSTOPMON, 30 JSTRTMON, 30 stream script, 23 suggested conversions, 45 Sun-compliant JDK version 1.