Sample program that transfers data from MySQL to Oracle (CLOB)

Table structure in Oracle SQL> desc scott.oracletable; Name Null? Type —————————————– ——– ———- TRANSDATE NOT NULL DATE SEQUENCE_NO NOT NULL NUMBER(6) LOBDATA NOT NULL CLOB Table structure in MySQL: Name Type —————————————– ——– trandate Date sequence_no smallint(6) textfield longtext — Code: TransferMySQLToOracle.java import java.sql.*; import java.io.*; import java.lang.StringBuffer; import java.util.Date; import java.text.SimpleDateFormat; public class TransferMySQLToOracle…

Sample JDBC program which connects to Oracle

Sample program that demonstrates using JDBC to connect to Oracle database. Source code $ cat TestConnection.java import java.sql.*; public class TestConnection { public static void main (String args []) throws SQLException, InterruptedException { DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver()); java.util.Properties props = new java.util.Properties(); // user/password@host:port:SID Connection conn = DriverManager.getConnection (“jdbc:oracle:thin:” + args[0] + “/” + args[1] +…

MySQL – JDBC connection example

—– Connect.java —- —- To compile c:> javac Connect.java —- Note: Make sure the CLASSPATH env is set. MySQL Connnector/J can be downloaded from http://dev.mysql.com/downloads/connector/ —- Example: CLASSPATH=mysql-connector-java-5.1.7\mysql-connector-java-5.1.7-bin.jar;. —- To run c:> java Connect — Connect.java code import java.sql.*; public class Connect { public static void main(String argv[]) throws Exception { Connection conn = null;…