Example 6 7   Source code of the MigBlob utility
import java.lang.*;
import java.io.*;
import java.sql.*;
public class MigBlob {
  private static final String MYHOST = "localhost";
  private static final String MYDB = "temp";
  private static final String MYUSR = "root";
  private static final String MYPWD = "";
  private static final String DB2DB = "sample";
  private static final String DB2USR = "itsosj";
  private static final String DB2PWD = "itsosj";
  private static Connection mysqlConnection, db2Connection;
  public static void main(String[] args) throws SQLException, Exception {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
mysqlConnection = DriverManager.getConnection(
"jdbc:mysql://" + MYHOST + "/" + MYDB +
"?user=" + MYUSR + "&password=" + MYPWD);
db2Connection = DriverManager.getConnection(
"jdbc:db2:" + DB2DB, DB2USR, DB2PWD);
    PreparedStatement ps1 = mysqlConnection.prepareStatement(
"select * from blobdata");
    ResultSet rs = ps1.executeQuery();
    if ( ! rs.next() ) {
      System.out.println("No rows in blobdata...");
      return;
    }
    InputStream is = rs.getBinaryStream("b");
    PreparedStatement ps2 = db2Connection.prepareStatement(
"insert into tempdb2.blobdata values(?)");
    ps2.setBinaryStream(1,is,is.available());
    ps2.executeUpdate();
  }
}
To use this program for migrating BLOBs, please follow these steps:
136 
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