JDBC samples
UNIX directory: sqllib/samples/java/jdbc
.
Windows directory: sqllib\samples\java\jdbc
.
JDBC samples include the following types of programs:
- ADMIN_CMD routine samples
- Samples that demonstrate the use of ADMIN_CMD stored procedure for administration tasks via SQL interface
- Installation-image-level samples
- Programs that deal with the installation image level of the database product.
- Database-level samples
- Programs that deal with database objects.
- Table-level samples
- Programs that deal with table objects.
- Data type samples
- Programs that deal with data types.
- Applet samples
- Samples that demonstrate Java applets.
- Stored procedure samples
- Samples that demonstrate stored procedures.
- User-defined function samples
- Samples that demonstrate user-defined functions.
- Java bean samples
- Samples that demonstrate Java bean classes.
- Java GSS-API Plugin samples
- Samples that demonstrate the JCC GCC_API plugin
- Other samples
- Samples that do not fall into any of the previous categories.
Type of sample | Sample program name | Program Description |
---|---|---|
ADMIN_CMD stored procedure samples | AdmCmdAutoCfg.java |
How to autoconfigure a database using ADMIN_CMD routine. |
AdmCmdOnlineBackup.java |
How to perform online backup using ADMIN_CMD routine. | |
AdmCmdUpdateCfg.java |
How to update and reset the Database and Database Manager configuration parameters using ADMIN_CMD routine. | |
AdmCmdExport.java |
How to export data using ADMIN_CMD routine. | |
AdmCmdImport.java |
How to import data using ADMIN_CMD routine. | |
AdmCmdQuiesce.java |
How to quiesce tablespace and database using ADMIN_CMD routine. | |
AdmCmdDescribe.java |
How to describe table and indices using ADMIN_CMD routine. | |
Installation-image-level samples | IlInfo.java |
How to get and set installation level information. |
Database-level samples | DbAuth.java |
How to grant/display/revoke authorities at the database level. |
DbConn.java |
How to connect and disconnect from a database. | |
DbInfo.java |
How to get and set information at a database level. | |
DbMCon.java |
How to connect and disconnect from multiple databases. | |
DbNative.java |
How to translate a statement that contains an ODBC escape clause to a data source specific format. | |
DbRsHold.java |
How to use result set cursor holdability in Universal JDBC driver for Linux, Unix and Windows. The Universal JDBC driver implements the result set cursor holdability APIS specified in JDBC3. | |
DbSeq.java |
How to create, alter and drop a sequence in a database. | |
DbUse.java |
How to use database objects. | |
GetDBCfgParams.java |
How to get database configuration parameters. | |
GetDBMCfgParams.java |
How to get database manager configuration parameters. | |
GetLogs.java |
How to get customer view of diagnostic log file entries. | |
TrustedContext.java |
How to create a trusted context, identify and use a trusted connection for switching user IDs, and acquire trusted context-specific privileges. | |
Table-level samples | Cgtt.java |
How to use created temporary tables with procedures, functions, triggers and views. |
GetMessage.java |
How to get error message in the required locale with token replacement. | |
ImplicitCasting.java |
How to use implicit casting. | |
LargeRid.java |
How to enable Large RIDs support on both new tables / tablespaces and existing tables/tablespaces. | |
ScalarFunctions.java |
How to use improved scalar functions. | |
SetIntegrity.java |
How to perform online SET INTEGRITY on a table. | |
TbAST.java |
How to use staging table for updating deferred AST. | |
TbCompress.java |
How to create tables with null and default value compression option. | |
TbConstr.java |
How to work with table constraints. | |
TbCreate.java |
How to create, alter and drop tables. | |
TbGenCol.java |
How to use generated columns. | |
TbIdent.java |
How to use Identity Columns. | |
TbInfo.java |
How to get and set information at a table level. | |
TbInTrig.java |
How to use an 'INSTEAD OF' trigger on a view. | |
TbMerge.java |
How to use the MERGE statement. | |
TbMod.java |
How to modify information in a table. | |
TbOnlineInx.java |
How to create and reorg indexes on a table. | |
TbPriv.java |
How to grant/display/revoke table level privileges. | |
TbRead.java |
How to read information in a table. | |
TbRowcompress.java |
How to perform row compression on a table and use the Automatic Dictionary Creation enhancement. | |
TbSel.java |
How to select from each of: insert, update, delete. | |
TbTemp.java |
How to use Declared Temporary Tables. | |
TbTrig.java |
How to use a trigger on a table. | |
TbUMQT.java |
How to use user materialzed query tables (summary tables). | |
TbUnion.java |
How to insert through a UNION ALL view. | |
Data types | DtInfo.java |
How to get information about data types. |
DtLob.java |
How to read and write LOB data. | |
DtUdt.java |
How to create, use, and drop user-defined distinct types. | |
Applet samples | Applt.java |
How to use applets. |
Stored procedure samples | spcat |
Stored procedure catalog script for the spserver program. This script calls SpDrop.db2 and SpCreate.db2 in UNIX. |
spcat |
Stored procedure catalog script for the spserver program. This script calls SpDrop.db2 and SpCreate.db2 in Windows. | |
SpCreate.db2 |
CLP script to issue CREATE PROCEDURE statements. | |
SpDrop.db2 |
CLP script to drop stored procedures from the catalog. | |
SpClient.java |
Client program used to call the server functions declared in SpServer.java. | |
SpServer.java |
Stored procedure functions built and run on the server. | |
Arrays_Sqlpl.java |
Use ARRAY variable in SQL stored procedure. | |
Array_Stack.java |
Use ARRAY variable in SQL stored procedure. Implement stack functions. | |
bonus_calculate.db2 |
Stored procdure code for Array_Sqlpl.java sample to query the bonus for an employee. | |
stack_functions.db2 |
Stored procdure code for Array_Stack.java sample to implement stack functions. | |
User-defined function samples | UDFcli.java |
Client application which calls the user-defined function library UDFsrv. |
UDFsrv.java |
User-defined functions called by UDFcli.java. | |
udfcat |
UDF catalog script for the UDFsrv program. This script calls UDFDrop.db2 and UDFCreate.db2 in UNIX. | |
udfcat |
UDF catalog script for the UDFsrv program. This script calls UDFDrop.db2 and UDFCreate.db2 in Windows. | |
UDFDrop.db2 |
CLP script to drop UDFs from the catalog. | |
UDFCreate.db2 |
CLP script to issue CREATE PROCEDURE statements. | |
UDFjcli.java |
Client application which calls the user-defined function library UDFjsrv. | |
UDFjsrv.java |
User-defined functions called by UDFjcli.java. | |
udfjcat |
UDF catalog script for the UDFjsrv program. This script calls UDFjDrop.db2 and UDFjCreate.db2 in UNIX. | |
udfjcat |
UDF catalog script for the UDFjsrv program. This script calls UDFjDrop.db2 and UDFjCreate.db2 in Windows. | |
UDFjDrop.db2 |
CLP script to drop UDFs from the catalog. | |
UDFjCreate.db2 |
CLP script to issue CREATE PROCEDURE statements. | |
UDFsCreate.db2 |
How to catalog the UDFs contained in UDFsqlsv.java | |
UDFsDrop.db2 |
How to uncatalog the UDFs contained in UDFsqlsv.java | |
UDFsqlcl.java |
Call the UDFs in UDFsqlsv.java | |
UDFsqlsv.java |
User-Defined Functions with SQL statements called by UDFsqlcl.java | |
Java bean samples | CreateEmployee.java |
How to create an employee record. |
GeneratePayroll.java |
How to generate payroll reports by department. | |
Java GSS-API Plugin samples | JCCKerberosPlugin.java |
Implement a GSS-API Plugin that does Kerberos authentication using IBM Db2® Universal Driver. |
JCCKerberosPluginTest.java |
Use JCCKerberosPlugin to get a Db2 Connection using IBM Db2 Universal Driver. | |
JCCSimpleGSSPlugin.java |
Implement a GSS-API Plugin that does userid and password checking using IBM Db2 Universal Driver. | |
JCCSimpleGSSContext.java |
Implement a GSSContext to be used by JCCSimpleGSSPlugin | |
JCCSimpleGSSCredential.java |
Implement a GSSCredential to be used by JCCSimpleGSSPlugin | |
JCCSimpleGSSException.java |
Implement a GSSException to be used by JCCSimpleGSSPlugin | |
JCCSimpleGSSName.java |
Implement a GSSName to be used by JCCSimpleGSSPlugin | |
JCCSimpleGSSPluginTest.java |
Use JCCSimpleGSSPlugin to get a Db2 Connection using IBM Db2 Universal Driver. | |
Other samples | Util.java |
Utilities for JDBC sample programs. |