Using JDBC Data Source with DB2
Upcoming SlideShare
Loading in...5

Like this? Share it with your network


Using JDBC Data Source with DB2

Uploaded on


  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Using JDBC Data Source with DB2 Elixir Repertoire support connectivity to DB2 via DB2 Universal JDBC driver with Elixir data source. Version tested : Prerequisite Below list the prerequisite that is needed to ensure a successful connection to Microsoft SQL Server. 1) DB2 Universal JDBC Drivers as jars db2jcc.jar, db2jcc_javax.jar, db2jcc_license_cu.jar This can be found in DB2 installation directory in IBMSQLLIBjava. 2) TCP is set. Default port is 50000 . 3) Ensure that the DB2 services are started 4) Deploy the driver into Elixir Repertoire ext directory. You have to the same if you are using Elixir Repertoire Server.
  • 2. 5) You can view the tables in DB2 Control Panel
  • 3. Creating a JDBC Data Source in Elixir Repertoire These are the following step to create JDBC Data Source in Elixir Repertoire. 1) Obtain the JDBC connection parameters They are the Database server database location, database name , port (50000 default), user name and password. Here is the different show in the table. Server DB2 Server version 9.1 JDBC Driver URL jdbc:db2:// example jdbc:db2://<host>:50000/dbname
  • 4. 2) Step to the next page to obtain the SQL Statement with Query Builder or enter a SQL statement to select the table i.e. SELECT * FROM ADMINISTRATOR.DEPARTMENT 3) Infer the schema
  • 5. 4) Finally you test the result of the SQL Statement in the Data->Load Data.
  • 6. Using DB2 Store Procedure Creating Store procedure in DB2. 1) Stored procedures are created in the Development Center, provided by IBM 2) You can use the wizard provide to create a select statement and test the procedures using the Development Center.
  • 7. 3) The Store procedure create as CREATE PROCEDURE PROCEDURE_EMPLOYEE_BY_DEPARTMENT (IN dept varchar(100) ) DYNAMIC RESULT SETS 1 ------------------------------------------------------------------------ -- SQL Stored Procedure ------------------------------------------------------------------------ P1: BEGIN -- Declare cursor DECLARE cursor1 CURSOR WITH RETURN FOR SELECT EMPNO, FIRSTNME, MIDINIT, LASTNAME, WORKDEPT, PHONENO, HIREDATE, JOB, EDLEVEL, SEX, BIRTHDATE, SALARY, BONUS, COMM FROM ADMINISTRATOR.EMP WHERE WORKDEPT LIKE dept; -- Cursor left open for client application OPEN cursor1; END P1 The in parameters is the varchar value for department number. 4)At the JDBC SQL entry wizard page, enters the store procedure as where call procedure-name[([parameter][,[parameter]]...)]. as with the above procedures call DB2ADMIN.PROCEDURE_EMPLOYEE_BY_DEPARTMENT('A001')
  • 8. 5) You can insert Dynamic parameter for UI as ${LabelName# Field type #default value }. The field type used is lookup where the the first parameter is the data source and second parameter is the field name. Where lookup is a special key to trigger a lookup to a data source and extract the value based on the field name to populate a combo box. The below is the an example ${DEPT#lookup(/ElixirSamples/DataSource/JDBC/DB2-V9/DEPT.ds,DEPTNO) This is the actual SQL. call DB2ADMIN.PROCEDURE_EMPLOYEE_BY_DEPARTMENT( '${DEPT#lookup(/ElixirSamples/DataSource/JDBC/DB2-V9/DEPT.ds,DEPTNO)#%} ') 6) Trigger the data source, the Dynamic entry combo box is generated
  • 9. 7) The valued displayed.
  • 10. Using Elixir Report to view image stored as Blob database type 1) Step through the similar JDBC data source 2) Enter the SQL query SELECT * FROM ADMINISTRATOR.EMP_PHOTO 3) Infer the schema Image which store as blob will be recognized as a SQL Blob type in Elixir Repertoire data source.
  • 11. 4) Create a report to view the image
  • 12. Report generated