Table 34. Java Database Connectivity (JDBC) Sample Programs
Sample Program Name | Program Description |
---|---|
BasicCon.java
| Basic connection. |
Browser.java
| List columns, foreign keys, index columns or stats for a table |
ColPriv.java
| List column Privileges |
Columns.java
| List all columns for table search string. |
DB2Appl.java
| A JDBC application that queries the sample database using the invoking user's privileges. |
DB2Applt.java
| A JDBC applet that queries the database using the JDBC applet driver. It uses the user name, password, server, and port number parameters specified in DB2Applt.html . |
DB2Applt.html
| An HTML file that embeds the applet sample program, DB2Applt . It needs to be customized with server and user information. |
DB2SpCli.java
| A Java client application that calls the JDBC stored procedure, DB2Stp . |
DB2Stp.java
| A Java stored procedure that updates the EMPLOYEE table on the server, and returns new salary and payroll information to the client. |
DB2UdCli.java
| A Java client application that calls the Java user-defined function, DB2Udf . |
Dynamic.java
| Demonstrates a cursor using dynamic SQL. |
Embedded.java
| Create, populate, list data from and drop a table. |
GetAttrs.java
| List some common environment, connection and statement options/attributes. |
GetData.java
| Simple querying and displaying of data from database. |
Inpcli.java
| A Java client application that calls the JDBC stored procedure, Inpsrv . |
Inpsrv.java
| A Java stored procedure demonstrating the SQLDA structure. It creates a PRESIDENTS table in the sample database with information received from the SQLDA, and returns the SQLCA status to the client application, Inpcli . |
JavaSample.java
| Creates the table, JAVA_SAMPLE, adds data, displays data, and deletes the table. |
JobChange.java
| Uses a statement and a prepared statement to query the database and update information at the same time (does the same as getcurs.c and setcurs.c but cannot do both ways therefore above method is used). |
LookRes.java
| Extract string from the resume clob field by converting the entire clob into a string, and searching for the desired substring. |
MRSPcli.java
| This is the client program that calls the server program MRSPsrv. The program demonstrates multiple result sets being returned from a Java stored procedure. |
MRSPsrv.java
| This is the server program that is called by the client program, MRSPcli. The program demonstrates multiple result sets being returned from a Java stored procedure. |
MultiCon.java
| Multiple connections. |
Outcli.java
| A Java client application that calls the SQLJ stored procedure, Outsrv . |
PicIn.java
| Loads graphic BLOBS into the emp_photo using the setBinaryStream method. |
PluginEx.java
| A Java program that adds new menu items and toolbar buttons to the DB2 Web Control Center. |
Prepare.java
| Rewrite of Simple.java, using a prepared statement. |
ProcCols.java
| List procedure parameters using getProcedureColumns under DatabaseMetaData. |
Procs.java
| List procedures using DatabaseMetaData.getProcedures. |
ShowPic.java
| Extracts BLOB picture to file using the getBinaryStream method. The file is read using the InputStream.read method. |
Simple.java
| Shows basic connecting querying and displaying the result set. (JDBC version of CLI sample fetch.c). |
StpCli.java
| A Java client application that calls the SQLJ stored procedure, Stp . |
Tables.java
| List all tables that match user defined search pattern. |
Tools.java
| Demonstrates a toolkit for Java programs written as DB2 samples. |
TypeInfo.java
| Display type information for all types for current data source. |
UDFcli.java
| A JDBC client application that calls functions in the Java user-defined function library, UDFsrv . |
UsingThreads.java
| Shows how to use threads to run an SQL statement asynchronously (JDBC version of CLI sample async.c). |
Varinp.java
| Demonstrates variable input to Embedded Dynamic SQL statement calls using parameter markers. |
Samples using ORDER tables created by Create.java (Run in the following order). | |
Create.java
| Creates all tables for the order scenario. |
CustIn.java
| Inserts customers into the customer table (array insert). |
ProdIn.java
| Inserts products into the products table (array insert). |
ProdPart.java
| Inserts parts into the prod_parts table (array insert). |
OrdIn.java
| Inserts orders into the ord_line, ord_cust tables (array insert). |
OrdRep.java
| Generates a customer order report and uses the user defined function 'price' defined in order.c. |
PartRep.java
| Generates exploding parts report (recursive SQL Query). |
DropJava.java
| Removes the new tables created for the ORDER scenario. |
Table 35. Embedded SQL for Java (SQLJ) Sample Programs
Sample Program Name | Program Description |
---|---|
App.sqlj
| Uses static SQL to retrieve and update data from the EMPLOYEE table of the sample database. |
Applt.sqlj
| An applet that queries the database using the JDBC applet driver. It uses the user name, password, server, and port number parameters specified in Applt.html . |
Applt.html
| An HTML file that embeds the applet sample program, Applt . It needs to be customized with server and user information. |
Cursor.sqlj
| Demonstrates an iterator using static SQL. |
OpF_Curs.sqlj
| Class file for the Openftch program. |
Openftch.sqlj
| Demonstrates fetching, updating, and deleting rows using static SQL. |
Outsrv.sqlj
| Demonstrates a stored procedure using the SQLDA structure. It fills the SQLDA with the median salary of the employees in the STAFF table of the sample database. After the database processing (finding the median), the stored procedure returns the filled SQLDA and the SQLCA status to the JDBC client application, Outcli . |
Static.sqlj
| Uses static SQL to retrieve information. |
Stp.sqlj
| A stored procedure that updates the EMPLOYEE table on the server, and returns new salary and payroll information to the JDBC client program, StpCli . |
UDFclie.sqlj
| A client application that calls functions from the Java user-defined function library, UDFsrv . |
Updat.sqlj
| Uses static SQL to update a database. |