11.9.OpenLink Demonstration Programs
To assist you further during your utilization or evaluation of OpenLink's Drivers for JDBC a number of demonstration JDBC compliant Applets and Applications are bundled with your OpenLink Driver for JDBC installation, these programs are provided in both binary and source code format for your free use. The sections that follow guide you through the process of using these programs
11.9.1.JDBC Compliant Applet Demos
Three JDBC applet samples are bundled with your OpenLink Driver for JDBC installation, each one of these demonstrating practical use of JDBC applets and highlighting OpenLink specific functionality. Each of these demos reside in the "samples\jdbc\jdk[10 or 11 or 12]" sub-directory below the directory into which you installed your OpenLink software. Each applet is accessible from the OpenLink Admin Assistant (an OpenLink agent that provides HTTP services like any Web Server does). The programs are:
-
JDBCDemo. demonstrates basic JDBC functionality via an Applet
-
ScrollDemo. demonstrates JDBC functionality via an Applet. It also demonstrates the additional Resultset navigation functionality provided by OpenLink's Scrollable Resultset & RowSet Extensions for JDBC on a Record by Record Basis.
-
ScrollDemo2. demonstrates JDBC functionality via an Applet. It also demonstrates the additional Resultset navigation functionality provided by JDBC 2.0
-
RowSetDemo. demonstrates JDBC functionality via an Applet. It also demonstrates the additional Resultset navigation functionality provided by OpenLink's Scrollable Resultset & RowSet Extensions for JDBC on a RowSet by RowSet Basis.
11.9.2.JDBCDemo
This applet demonstrates basic JDBC functionality via an Applet.
Utilization Steps:
-
Start the OpenLink Request Broker
-
Start up your Web Browser
-
Enter one of the following URLs into your browser depending on the location of your OpenLink Request Broker:
Local To you:
http://localhost:8000
Remote Server:
http://<hostname or IP address of remote server>:8000
Note: Port "8000" presumes that you provide this value when prompted during your OpenLink Sever components installation.
-
Follow the Admin Assistant's Menu tree to the location of the "Sample Applications->JDBC Applet Demos" menu item. The graphic below depicts this process.
Figure11.7.JDBC Applet Demos
-
Click on the hyperlink that reads "Applet demonstration with OpenLink Software JDBC Driver"
-
Use the Applet's File->Set Connection URL menu item to enter a URL to the data source. If uncertain follows the instructions laid out in the section covering OpenLink JDBC URL formats which shows you how to construct Type 1, 2, and 3 URL formats for your OpenLink Drivers for JDBC. This applet will run with non OpenLink Drivers for JDBC but you will need to obtain URL construction information from the relevant driver vendor.
The line below depicts the URL construction dialog presented:
jdbc:openlink://localhost/SVT=Oracle 7/DATABASE=ORCL/UID=scott/PWD=tiger
-
Enter a valid SQL statement for the backend database that you are connecting to via JDBC and then click on the "Query" button. The screen shot below depicts this process:
Figure11.8.WebJDBC Applet Demo
-
Basic JDBC 1.1 functionality provides Forward-Only as opposed to Bi-Directional record Scrolling, this is why the basic JDBC applet on has a "Next" button. When you click on the "Next" button you are moved to the next record in your JDBC resultset, unfortunately you have to hit the "Query" button again and re-start the Forward-Only resultset navigation if you need to see the First or Prior resultset records from your current position. The examples that follow show how OpenLink and the new release of JDBC (version 2.0) address the Bi-Directional Scrolling Limitation demonstrated by this Applet.
11.9.3.ScrollDemo
This program demonstrates JDBC functionality via an Applet. It also demonstrates the additional Resultset navigation functionality provided by OpenLink's Scrollable Resultset & RowSet Extensions for JDBC on a Record by Record Basis.
Utilization Steps:
-
Start the OpenLink Request Broker.
-
Start up your Web Browser
-
Enter one of the following URLs into your browser depending on the location of your OpenLink Request Broker:
Local To you:
http://localhost:8000
Remote Server:
http://<hostname or IP address of remote server>:8000
Note: Port "8000" presumes that you provide this value when prompted during your OpenLink Sever components installation.
-
Follow the Admin Assistant's Menu tree to the location of the "JDBC Applet Demos" menu item. The graphic below depicts this process.
Figure11.9.WebJDBC Applet Demo
-
Click on the hyperlink that reads "Applet demonstration with OpenLink Software JDBC Scrollable Cursor extensions"
-
Use the Applet's File->Set Connection URL menu item to enter a URL to the data source. If uncertain follows the instructions laid out in the section covering OpenLink JDBC URL formats which shows you how to construct Type 1, 2, and 3 URL formats for your OpenLink Drivers for JDBC.
The line below depicts the URL construction dialog presented:
jdbc:openlink://localhost/SVT=Oracle 7/DATABASE=ORCL/UID=scott/PWD=tiger
-
Enter a valid SQL statement for the backend database that you are connecting to via JDBC and then click on the "Query" button. The screen shot below depicts this process:
Figure11.10.WebScroll Applet Demo
-
JDBC 1.1 functionality provides Forward-Only as opposed to Bi-Directional Resultset Scrolling, OpenLink's Scrollable Resultset Extensions for JDBC enable Bi-Directional Resultset Scrolling. This is why this applet has an additional set of Resultset Navigation buttons: "First","Next", "Prior","Last", "Lock", "Unlock", "Add", "Update", "Get Bookmark", "Set Bookmark", "and Go To" . The existence of Bi-directional Scrollable Resultsets (or Cursors) is often presumed by end-users and developers alike, its importance rarely understood prior to embarking upon JDBC application development or product selection, the unfortunate consequence being complex application re-writes or implementation of sub par JDBC solutions. Each of the button in the applet demo is explained below so as to understand the magnitude of this issue:
Table11.15.Scroll Demo Keys Explained
Button Explanation First takes you to first record in the Resultset Next takes you to the next record in the Resultset from your current position Prior takes you to the previous record in the Resultset from your current position Last takes you to the last record in the Resultset Lock locks the current record Unlock unlocks the current record Add add a new record to database Update change current record Delete remove current record from database Get Bookmark mark current record position for future revisit Set Bookmark revisit previous marked position in current ResultSet Go To go directly to a specific record number within the current ResultSet Refresh Reopen current resultset
11.9.4.ScrollDemo2
This applet demonstrates JDBC functionality via an Applet. It also demonstrates the additional Resultset navigation functionality provided by JDBC 2.0
This Applet require a browser that is Java Virtual Machine version 1.2.x or 2.x compliant. If you do not have such a Browser, you can simply run the JDBC Application version of this program.
Utilization Steps:
-
Start the OpenLink Request Broker
-
Start up your Web Browser
-
Enter one of the following URLs into your browser depending on the location of your OpenLink Request Broker:
Local To you:
http://localhost:8000/
Remote Server:
http://<hostname or IP address of remote server>:8000
Note: Port "8000" presumes that you provide this value when prompted during your OpenLink Sever components installation.
-
Follow the Admin Assistant's Menu tree to the location of the "Sample Applications->JDBC Applet Demos" menu item. The graphic below depicts this process.
Figure11.11.Scroll2 Applet Demo
-
Click on the hyperlink that reads "Applet demonstration with OpenLink Software JDBC 2.0 Scrollable Cursors"
-
Use the Applet's File->Set Connection URL menu item set register your Driver for JDBC 2.0 and then enter a URL pointing to an ODBC DSN. If uncertain follow the instructions laid out in the section covering OpenLink JDBC URL formats which shows you how to construct Type 1, and 3 URL formats for your OpenLink Drivers for JDBC. This applet will run with non OpenLink Drivers for JDBC but you will need to obtain Driver registration and JDBC URL construction information from the relevant Driver vendor.
The screen shot below depicts the URL construction dialog presented:
Figure11.12.Connection dialog
-
Enter a valid SQL statement for the backend database that you are connecting to via JDBC and then click on the "Query" button.
-
JDBC 1.1 functionality provides Forward-Only as opposed to Bi-Directional Resultset Scrolling, JDBC 2.0 on the other hand supports Bi-Directional Resultset Scrolling. As a result this applet has an additional set of Resultset Navigation buttons: "First","Next", "Previous","Last", "Insert", "Update", "Absolute", "Relative". Unfortunately JDBC 2.0 does not provide Bookmarking or Row Level concurrency control hence the exclusion of the "Lock", "UnLock", "Go To", "Set Bookmark", "Get Bookmark" navigation buttons provided in the "ScrollDemo" applet. To use this functionality in a JDBC 2.0 environment you simply make use of the OpenLink Scrollable ResultSet & RowSet Extensions.
Each navigation button is described below so as to shed more light on the Scrollable ResultSet functionality provided by JDBC 2.0.
Table11.16.Scroll Demo Keys Explained
Button Explanation First takes you to first record in the Resultset Next takes you to the next record in the Resultset from your current position Previous takes you to the previous record in the Resultset from your current position Last takes you to the last record in the Resultset Add add a new record to database Update change current record Delete remove current record from database Relative moves N number of records forward from the current record where N represents a value entered into the field beside the "Relative" button. IF the field contains a negative number then it indicates a backwards move. Absolute go directly to record number N within the current ResultSet where N represents a value entered into the field beside the "Relative" button, the actual direction of Resultset navigation depends on the actual location of the record in question Refresh Reopen current resultset
11.9.5.RowSetDemo
This applet demonstrates JDBC functionality via an Applet. It also demonstrates the additional Resultset navigation functionality provided by OpenLink's Scrollable Resultset & RowSet Extensions for JDBC on a RowSet by RowSet Basis.
Utilization Steps:
-
Start the OpenLink Request Broker
-
Start up your Web Browser
-
Enter one of the following URLs into your browser depending on the location of your OpenLink Request Broker:
Local To you:
http://localhost:8000
Remote Server:
http://<hostname or IP address of remote server>:8000
Note: Port "8000" presumes that you provide this value when prompted during your OpenLink Sever components installation.
-
Follow the Admin Assistant's Menu tree to the location of the "Sample Applications->JDBC Applet Demos" menu item. The graphic below depicts this process.
Figure11.13.Connection dialog
-
Click on the hyperlink that reads "Applet demonstration with OpenLink Software JDBC Scrollable Cursor RowSet Extensions"
-
Use the Applet's File->Set Connection URL menu item set a URL pointing to an ODBC DSN. If uncertain follows the instructions laid out in the section covering OpenLink JDBC URL formats which shows you how to construct Type 1 and 3 URL formats for your OpenLink Drivers for JDBC. This applet will run with non OpenLink Drivers for JDBC but you will need to obtain URL construction information from the relevant driver vendor.
The screen shot below depicts the URL construction dialog presented:
Figure11.14.URL Construction
-
Enter a valid SQL statement for the backend database that you are connecting to via JDBC and then click on the "Query" button. The screen shot below depicts this process:
Figure11.15.Querying
-
JDBC 1.1 functionality provides Forward-Only as opposed to Bi-Directional Resultset Scrolling, JDBC 2.0 provides Scrollable Resultsets but does not provide Bookmarking or Attached RowSets (transient RowSets located in the same process space as the ResultSet). OpenLink's Scrollable Resultset Extensions for JDBC address these issues irrespective of JDBC version. As a result this applet has an additional set of Resultset Navigation buttons when compared to the basic JDBC 2.0 Applet in the prior section, the buttons are: "First","Next", "Prior","Last", "Lock", "Unlock", "Add", "Update", "Get Bookmark", "Set Bookmark", "and Go To" . The existence of transient RowSets due to Bi-directional Scrollable Resultsets (or Cursors) in JDBC 2.0 is more than likely presumed to exist by end-users and developers alike, it is important that you take note of this before embarking upon JDBC 2.0 application development or product selection. Each of the buttons in the Applet demo is explained below so as to assist in the understanding of these matters:
Table11.17.Scroll Demo Keys Explained
Button Explanation First takes you to first RowSet in the Resultset Next takes you to the next RowSet in the Resultset from your current position Prior takes you to the previous RowSet in the Resultset from your current position Last takes you to the last RowSet in the Resultset Lock locks the current RowSet Unlock unlocks the current RowSet Add add a new record to database Update change current record with the current RowSet of Delete remove current record from within the current RowSet from the database Get Bookmark mark current RowSet within Resultset for future revisit Set Bookmark revisit previous marked RowSet position in current ResultSet Go To go directly to a specific record number within the current ResultSet Refresh Reopen current resultset
11.9.6.JDBC compliant Application Demos
All the JDBC compliant Applet demos described in the previous sections have also been implemented as JDBC compliant Applications Demos, you can run these programs in a number of ways depending on operating system hosting your Java Virtual Machine.
Windows 95/98/NT/2000
-
Click on your Windows Start Menu Button
-
Select the "OpenLink Data Access Drivers" Start Menu Group
-
Locate the "JDBC Samples" Menu Item
-
Choose from the list of JDBC Applications presented
Linux or UNIX
-
Move into your OpenLink base installation directory
-
The move to the following directory listing output maps out the location of the various JDBC Application demos by Java Virtual Machine version:
JDBC/jdk1.1.x/Applications: JDBCDemo RowSetDemo ScrollDemo JDBC/jdk1.1.x/Applications/JDBCDemo: DialogConnection.class JDBCDemo.class DialogConnection.java JDBCDemo.java JDBC/jdk1.1.x/Applications/RowSetDemo: DataTextField.class DialogConnection.java readme.txt DataTextField.java RowSetDemo.class DialogConnection.class RowSetDemo.java JDBC/jdk1.1.x/Applications/ScrollDemo: DialogConnection.class ScrollDemo.class readme.txt DialogConnection.java ScrollDemo.java JDBC/jdk1.2.x/Applications: JDBCDemo RowSetDemo ScrollDemo ScrollDemo2 JDBC/jdk1.2.x/Applications/JDBCDemo: DialogConnection.class JDBCDemo.class DialogConnection.java JDBCDemo.java JDBC/jdk1.2.x/Applications/RowSetDemo: DataTextField.class DialogConnection.java readme.txt DataTextField.java RowSetDemo.class DialogConnection.class RowSetDemo.java JDBC/jdk1.2.x/Applications/ScrollDemo: DialogConnection.class ScrollDemo.class readme.txt DialogConnection.java ScrollDemo.java JDBC/jdk1.2.x/Applications/ScrollDemo2: DialogConnection.class ScrollDemo2.class DialogConnection.java ScrollDemo2.java JDBC/jdk1.3.x/Applications: JDBCDemo RowSetDemo ScrollDemo ScrollDemo2 JDBC/jdk1.3.x/Applications/JDBCDemo: DialogConnection.class JDBCDemo.class DialogConnection.java JDBCDemo.java JDBC/jdk1.3.x/Applications/RowSetDemo: DataTextField.class DialogConnection.java readme.txt DataTextField.java RowSetDemo.class DialogConnection.class RowSetDemo.java JDBC/jdk1.3.x/Applications/ScrollDemo: DialogConnection.class ScrollDemo.class readme.txt DialogConnection.java ScrollDemo.java JDBC/jdk1.3.x/Applications/ScrollDemo2: DialogConnection.class ScrollDemo2.class DialogConnection.java ScrollDemo2.java
-
Move into the appropriate directory and then execute the following command:
java <classname>
where "<classname>" represents the JDBC class file hosting your JDBC application demo. For instance if you wanted to run the "RowSetDemo" JDBC application you would type the following:
java RowSetDemo