CONNX JDBC Sample Application
The CONNX JDBC Sample Application demonstrates CONNX JDBC in both a Windows and non-Windows environment. The sample application enables the user to formulate one- or two-parameter queries or to enter standard SQL statements directly from the keyboard.
With queries that use parameters, the application demonstrates data type conversion, which enables the user to cast a column of data from its native data type to a more convenient date type. For example, a web page designer might want to retrieve all data as String, even though the native data types might include Integer, Float, etc.
To use the CONNX JDBC sample application in a Microsoft Windows environment, launch the CONNX JDBC Sample Application.
To start the CONNX JDBC Sample Application in a non-Windows environment, verify that the connxjdbcftp.jar file has been copied and unpacked to the non-Windows target. Go to Installation directory\CONNXJDBC\ JAVA\SAMPLES. Type: sh sapplic_unix.
Connecting to the Data Source
In the Connection group box in the Query Test Application window, enter:
Gateway: The local server TCP/IP address or host name. To determine the existence of a valid Gateway, open an MS-DOS prompt, and type
ping localhost.
DSN (Data Source Name): The data source name as registered with the DSNRegistry tool on the CONNX JDBC Server machine. When CONNX is installed, the CDD DSN connxSamples is automatically created and registered to enable access to the CONNX8Sample database.
User ID: CONNX user name.
Password: CONNX password.
Application: Database connection option (for example, Oracle or RMS). This text box may be left blank if all servers are running that contain the databases listed in the CONNX Data Dictionary. If any of the servers are down, or if the server running the application specified in the
Application text box is down, the connection times out.
Port: The port number (default is
7500).
Click Connect in the Connection group box.
After the connection to the data source is established, the Disconnect button in the Connection group box and the Query and Clear Query buttons in the SQL Statement from Keyboard group box are activated.
Choosing an Output Type
The available output types are:
To screen: directs output to the computer screen (the default). If you select the
To screen option, the result set appears in the
Data Grid and the
Navigator bar becomes active.
To output file: directs output to an output file. If you select thisoption, the
Output File group box is activated. Click
Browse to locate an existing file, or type a file name in the
Output File text box. The result set of each query is appended to an existing file. If no file is specified, the results of the most recent query overwrite the tmp.out file, located in the \CONNXJDBC\Java\Samples subdirectory where CONNX was originally installed (usually C:\CONNX32).
Choosing a Query Type
The available query types are:
SQL Statement from Keyboard (default): type an SQL statement directly from the keyboard. The
Query and
Clear Query buttons are activated in the
SQL Statement from Keyboard group box. Type an SQL statement into the
SQL Statement from Keyboard text box. If you end the SQL Statement with a semicolon (;), a syntax error appears.
One-parameter query: enter the query information in the
One-parameter Query group box.
Table Name: the name of the table to be queried.
Selected Columns: the names of the columns in the result set, separated by commas. Enter an asterisk (*) to retrieve all columns from the table.
Parameter Column: the name of the column that contains the parameter.
Parameter Value: the parameter that limits the data set.
Parameter Data Type (optional): the desired data type for the retrieved parameter column (may be different from its native data type). If a Parameter Data Type is not selected, the returned data defaults to String.
Two-parameter query: еnter the query information in the Two-parameter Query group box.
Table Name: the name of the table to be queried.
Selected Columns: the names of the columns in the answer set, separated by commas. Enter an asterisk (*) to retrieve all columns from the table.
Parameter Column: the name of the column that contains the parameter.
Low Value: the low parameter value that sets the lower bound of data.
High Value: the high parameter value that sets the upper bound of data.
Parameter Data Type (optional): the desired data type for the retrieved parameter column (may be different from its native data type). If a Parameter Data Type is not selected, the returned data defaults to String.
Click Query to execute the query.
Navigation Bar
Use the Navigator bar to examine or modify the data set. The data set represents a live link to the original data.
Any saved changes to the data set are saved to the original data source if the user has update privileges.
The Navigator bar contains the following keys:
First: moves the cursor to the first row of the data set.
Prior: moves the cursor to the previous row of the data set.
Next: moves the cursor to the next row of the data set. If focus is on the last row when the button is clicked, a new (blank) row opens.
Last: moves the cursor to the last row of the data set.
Insert: opens a new (blank) row to allow data entry (must be Saved to be made permanent). Produces an error if user does not have update privileges.
Delete: deletes the selected row (must be Saved to be made permanent). Produces an error if user does not have update privileges.
Post: if selected row has been edited, saves changes to the selected row only. Important: no changes are permanently saved back to the data source unless the Save button is used and the user has update privileges.
Cancel: cancels modifications made to the selected row of data. The data is restored to the way it was before the edit began or to the state it was since the last Save.
Ditto: copies the data from the row above to the selected row.
Save: saves all changes made since the last Save to the data source. This is a permanent change that affects the original data source. Produces an error if user does not have update privileges.
Refresh: refreshes the data set from the original data source.