JDBC Type 4 Driver 2.0 Programmer's Reference (SQL/MX 2.x)

//
// To run this example, issue the following:
// # java TestBLOB 1 TestBLOB.class 1000
//
import java.sql.*;
import java.io.*;
public class TestBLOB
{
public static void main (String[] args)
throws java.io.FileNotFoundException, java.io.IOException
{
int numBytes;
int recKey;
long start;
long end;
Connection conn1 = null;
// Set t4slqmx.blobTableName System Property. This property
// can also be added to the command line through
// "-Dt4slqmx.blobTableName=...", or a
// java.util.Properties object can be used and passed to
// getConnection.
System.setProperty( "t4slqmx.blobTableName","cat.sch.blobdatatbl" );
if (args.length < 2) {
System.out.println("arg[0]=; arg[1]=file; arg[2]=");
return;
}
// byte array for the blob
byte[] whatever = new byte[5000];
for (int i=0; i<5000; i++) whatever[i] = 71; // "G"
String k = "K";
for (int i=0; i<5000; i++) k = k + "K";
System.out.println("string length = " + k.length());
java.io.ByteArrayInputStream iXstream
= new java.io.ByteArrayInputStream(whatever);
numBytes = iXstream.available();
if (args.length == 3)
numBytes = Integer.parseInt(args[2]);