JDBC Driver for SQL/MX Programmer's Reference
// - use Outputstream.write(byte[])
//
// ***** The following is the PreparedStatement interface...
// - need an Inputstream object that already has data
// - need a PreparedStatement object that contains the
// 'insert...' DML of the base table
// - ps.setAsciiStream() for the lob data
// - ps.executeupdate(); for the DML
//
// To run this example, issue the following:
// # java TestCLOB 1 TestCLOB.java 1000
//
import java.sql.*;
import java.io.*;
public class TestCLOB
{
public static void main (String[] args)
throws java.io.FileNotFoundException,
java.io.IOException
{
int length = 500;
int recKey;
long start;
long end;
Connection conn1 = null;
// Set jdbcmx.clobTableName System Property. This property
// can also be added to the command line through
// "-Djdbcmx.clobTableName=...", or a
// java.util.Properties object can be used and passed to
// getConnection.
System.setProperty( "jdbcmx.clobTableName","cat.sch.clobdatatbl" );
if (args.length < 2) {
System.out.println("arg[0]=; arg[1]=file;
arg[2]=");
return;
}
String k = "K";
for (int i=0; i<5000; i++) k = k + "K";
System.out.println("string length = " + k.length());
FileInputStream clobFs = new FileInputStream(args[1]);
int clobFsLen = clobFs.available();