Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 4. Connect IBM i5/OS with JDBC > Command line JDBC application - Pg. 53

4.2.2 Creating the sample database All the examples in this chapter use a sample database. The creation of the sample database is done using the stored procedure CREATE_SQL_SAMPLE(" library "), where library is the name of the sample library you wish to create. This stored procedure is new in version 5 release 1 and shipped with the operating system. To create the sample database perform the following steps: 1. STRSQL To get into interactive SQL 2. CALL QSYS/CREATE_SQL_SAMPLE(`DBSAMPLE') To create the library (or collection in SQL terminology) with the sample tables Creating the sample database takes a couple of minutes to complete. After it is completed you have 13 tables and numerous logical views. Sample data is also included in the tables. There are two sets of database tables in the sample schema. One set includes tables ORG, STAFF, and SALES. This set is a very simple schema with limited interaction between the tables and less complex data types within the tables. The remaining ten tables make up a more complicated database schema and makes use of more complex data types, such as BLOBS and CLOBS. These tables also interact with each other much more. 4.3 Command line JDBC application To get started with JDBC programming on Linux, you can start with a command line approach where all input is from standard input and all the output is sent to standard out. This is a great way to test your JDBC and SQL code without the worries of the graphical interfaces. The