Retrieving LOB Data

You can retrieve Blob, Clob and NClob column’s data from a result set using the getBlob(), getClob(), and getNClob() methods of the ResultSet interface, respectively. These methods return an object of the java.sql.Blob, java.sql.Clob, and java.sql.NClob interfaces, respectively. These interfaces include many methods that let you query the LOB object and manipulate the data they represent. The following snippet of code reads rows from the person_detail table for the person_detail_id equal to 1001:

Connection conn = JDBCUtil.getConnection();String SQL = "select person_id, picture, resume " +             "from person_detail " +             "where person_detail_id = ?";PreparedStatement pstmt = null;pstmt = conn.prepareStatement(SQL); ...

Get Beginning Java 8 APIs, Extensions and Libraries Swing, JavaFX, JavaScript, JDBC and Network Programming APIs now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.