| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import java.lang.*;
- import java.io.*;
- import java.sql.*;
- import com.informix.jdbc.*;
- import com.informix.udr.*;
- public class LO
- {
-
- public static Clob lo() throws SQLException
- {
- Connection myConn = null;
- String connURL = "jdbc:informix-direct:";
- try
- {
-
- Class.forName("com.informix.jdbc.IfxDriver");
-
- myConn = DriverManager.getConnection(connURL);
-
- PreparedStatement pstmt = myConn.prepareStatement(
- "delete from mytable");
- pstmt.executeUpdate();
- pstmt.close();
-
- pstmt = myConn.prepareStatement( "insert into mytable values(?)");
- String inp = "This was a String -- now it's a large object";
- byte ba[] = inp.getBytes();
- InputStream is = new ByteArrayInputStream(ba);
- pstmt.setAsciiStream(1, is, ba.length);
- pstmt.executeUpdate();
- pstmt.close();
-
-
- Statement stmt = myConn.createStatement();
- ResultSet rs = stmt.executeQuery("select c from mytable");
- rs.next();
-
-
- Clob c = ((ResultSet2)rs).getClob(1);
- stmt.close();
- return (Clob)c;
- }
- catch (Exception ex)
- {
- throw new SQLException(ex.toString());
- }
- }
- }
|