SUI and DB2 UDB

Introduction:

Sui and DB2 UDB work very well together. During the development of Sui a number of users have extensively used Sui to access DB2 data. These users have accessed DB2 UDB for OS/390 (V5, V6, V7 and V8) using DB2 Connect personal edition they have also used Sui to access data on DB2 UDB on Win using the Personal and Enterprise editions.

Specific strengths when accessing DB2 for OS/390 (Z/OS):

· DB2 UDB sub-systems on OS/390 often tend to have a large number of tables. Thousands or even tens of thousands of tables is not unusual. If you ever have tried to access DB2 for OS/390 system using access or Excel thru ODBC (without customizing the ODBC Settings) you know that it can take a couple of minutes to build the table list. Sui let you choose if you want to limit the table list or not before listing the tables (Edit->Sui Preferences, Table Filter)

· Sui let you specify the isolation level of the query. If you want too access a production OS/390 DB2 system and just want to issue Select statements, un-commited Read might be a good choice.

· Sui closes the cursor after the query is completed. The cursor is closed regardless if the cursor has fetched all rows in the result-set or the max no of rows have been reached. Implying that no locks are held after the query returns the result set.

        · Sui releases the connection between queries. Implying that the connection only exists when the query executes.

Set-up a  connection to a DB2 database:

In this sample scenario the user wants to set up a database connection to a database that is catalogued in DB2 under the name SAMPLE using the type-2 driver (DB2 Appl). In this example the user have catalogued the database locally on the user machine (using DB2 Connect, DB2 UDB or DB2 Client). To make the database selectable from the query window follow these steps:

· Select File-> Available JDBC resources

· Select the Sample Driver Combo Box and select the row labeled 'DB2-Appl'

· Select the left arrow button, to add the DB2 Appl driver to the Driver Properties list

· Select the Sample URL Combo Box and select the row labeled 'DB2-Appl'

· Select the left arrow button, to add the DB2-Appl URL to the URL Properties list

· Change the text within the brackets (<>) to SAMPLE (your database) and remove the brackets  (for example jdbc:db2:SAMPLE)

· Click the OK Button

Problem resolution Q and A's for DB2

Q: When i try to connect, I get a message stating that the Driver can’t be found. (Or the connection fails with any obvious messages). What is wrong?
A: Make sure that the DB2 drivers are added to the system classpath (In general the DB2 drivers is added to the system classpath during installation). Issue the command SET CLASSPATH (on Win NT, 2000 or XP) or SET (on Win 95, 98 or ME) to verify if DB2's driver is included or not. If the driver is not included in the classpath you can add it using Sui's dynamic classpath function (File->Sui Preferences and the classpath tab). The picture below shows a sample. (To add new classpaths using the file browser, click the left arrow button).


Q: Can I use the JDBC/ ODBC Driver to access DB2 data?
A: Yes you can, you should however be aware that you get a performance degradation you also loose some functionality. The general recommendation is to use the native DB2 JDBC drivers, if possible.

Q: As i understand a java run time environment is included in DB2 (on Windows, Linux and Unix). Can I use DB2's java runtime rather then installing a new java runtime?

A: If you are using DB2 UDB version 8 or later the answer is yes. You can specify the path to the java runtime library from Sui's launcher program. If Sui dont find a JRE at startup the following screen is shown (if the screen is not show execute the program SuiLaunch from Sui's installation directory).

 


Use the browse button to select the directory where DB2's JRE resides. This setting is saved when the apply button is pressed and will be used for later invocations of Sui.

 

Q: Does Sui support DB2's universal driver (the universal driver is a native java JDBC type 4 driver).

A: Yes Sui support the universal driver.

Some usefull DB2 Links:

 

Link Title

Link

Description

IBM's DB2 Homepage

http://www.ibm.com/software/data/db2/

General information about DB2

DB2 and JAVA

http://www.ibm.com/software/data/db2/java/

DB2 and JAVA information