The JDBC type 1 driver /JDBC ODBC bridge provided by Sun Microsystem can 
be used for DB2 UDB. IBM does not guarantee or recommend this driver.
You can use any type of driver according to your requirement, but we suggest 
that you directly convert your MySQL Java application to DB2 Java application by 
using DB2 Universal JDBC driver instead of MySQL JDBC Driver. 
For more information on Java application development and the JDBC 
specification, see the DB2 Universal Database Java Web site at: 
http://www.ibm.com/software/data/db2/udb/ad/v8/java/
Embedded SQL for Java
DB2 UDB provides embedded SQL (both static and dynamic) access to Java 
applications though SQLj APIs. DB2 SQLj support allows you to create, build, 
and run embedded SQL for Java applications, applets, stored procedures, and 
user defined functions (UDFs). SQLj requires 
sqllib/java/sqlj.zip
 and 
sqllib/java/runtime.zip
.
Conversion of JDBC application
As both MySQL and DB2 UDB comply to JDBC specification, the Java 
application does not require a lot of code changes. It might be required to change 
SQL statements as discussed in DDL differences in Chapter 5,  Database 
porting  on page 89. 
In this section we provide you information on the Java program conversion from 
MySQL to DB2 UDB.
Loading JDBC Driver
First step in the Java program is loading of the appropriate JDBC driver. This is 
done by calling 
Class.forName(drivername)
 in your Java program. Appropriate 
values for the driver name are already discussed in  IBM JDBC driver for DB2  on 
page 189. Example 7 38 shows loading of the driver for MySQL, and 
Example 7 39 shows the DB2 UDB conversion using Universal driver.
Connecting to database
In this part the Java program tries to establish a connection to the given 
database. This is done by calling 
DriverManager.getConnection
 with the proper 
URL values, which was discussed in the driver description in  IBM JDBC driver 
for DB2  on page 189. After this call DriverManager selects the appropriate driver 
from set of registered drivers, which actually connects to the database. 
Example 7 38 and Example 7 39 show these steps for MySQL and DB2 UDB 
respectively. 
192 
MySQL to DB2 UDB Conversion Guide






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

san diego web hosting

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved