Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle BLOB Insert using createTemporary
Well i found the solution, thought it might be useful to someone.
public static void main (String args []) throws SQLException {
try { DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@malkit-1:1521:oracle92", "scott", "tiger"); PreparedStatement ps = conn.prepareStatement("INSERT INTO BLOBTABLE VALUES (?)"); oracle.sql.BLOB newBlob =
String str = "This string, up to 4 gigabytes will be inserted into the BLOB";
newBlob.putBytes(1, str.getBytes()); ps.setBlob(1, newBlob); int rowcnt = ps.executeUpdate(); System.out.println("Successful update of "+rowcnt+" row"); ps.close(); conn.close();
}
catch (Exception e) { System.out.println("Java Exception caught, error message="+e.getMessage());
}
Malkit Received on Fri Dec 03 2004 - 14:51:05 CST