/ Published in: Java

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
conn.setAutoCommit(false); // Get the Large Object Manager to perform operations with LargeObjectManager lobj = ((org.postgresql.PGConnection)conn).getLargeObjectAPI(); ps.setString(1, "myimage.gif"); if (rs != null) { while (rs.next()) { // Open the large object for reading int oid = rs.getInt(1); LargeObject obj = lobj.open(oid, LargeObjectManager.READ); // Read the data byte buf[] = new byte[obj.size()]; obj.read(buf, 0, obj.size()); // Do something with the data read here // Close the object obj.close(); } rs.close(); } ps.close(); conn.commit();
URL: http://www.postgresql.org/docs/7.4/static/jdbc-binary-data.html
Comments
