1. Install MySQL JDBC driver (if not installed yet)
In order to run the Java program you need to download and install the MySQL 
JDBC driver, if it is not already installed on your system. Make sure that both 
the MySQL JDBC driver and the DB2 JDBC driver, which is installed during 
DB2 Installation, are in your 
CLASSPATH
 environment variable. Your 
CLASSPATH
value could look like Example 6 8.
Example 6 8   Sample CLASSPATH including MySQL and DB2 JDBC drivers
bash>echo $CLASSPATH
/home/db2inst1/sqllib/java/db2java.zip:/home/db2inst1/sqllib/java/db2jcc.ja
r:/home/db2inst1/sqllib/function:/home/db2inst1/sqllib/java/db2jcc_license_
cisuz.jar:/home/db2inst1/sqllib/java/db2jcc_license_cu.jar:.:/usr/local/mys
ql/jdbc/mysql connector java 3.0.10 stable bin.jar
2. Edit the 
MigBlob 
Java source code and insert your database connectivity 
information (user ID and password for both MySQL and DB2 UDB). Compile 
the Java source code:
bash>javac MigBlob.java
3. Connect to MySQL and create the temporary MySQL table for the 
MigBlob
utility: 
mysql>create table temp.blobdata (b longblob)
;
4. Connect to DB2 UDB and create the temporary DB2 table for the 
MigBlob
utility:
db2>create table tempdb2.blobdata (b blob(2g) not logged)
5. Insert the BLOB you want to migrate into the temporary MySQL table:
mysql>insert into temp.blobdata select  from  
where =
6. Run the 
MigBlob
 utility to copy the BLOB from MySQL to DB2 UDB:
bash>java MigBlob
Please note that just 
one
 BLOB is copied by the 
MigBlob
 utility, so you have 
to run the utility for each BLOB you want to migrate, or you enhance the 
MigBlob
 utility.
7. Insert the BLOB from the temporary DB2 table into the designated field (be 
sure to use the key fields corresponding to the MySQL table):
db2>insert into  () (select b from 
tempdb2.blobdata) where =
8. Drop the temporary MySQL table:
mysql>drop table temp.blobdata;
 Chapter 6. Data porting 
137






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