DB2 10.5 for Linux, UNIX, and Windows

DB2JSONResultSet interface

The com.ibm.db2.jcc.DB2JSONResultSet interface is used to convert the contents of JDBC ResultSet objects to JSON documents and snippets.

The DB2JSONResultSet interface is available only in IBM® Data Server Driver for JDBC and SQLJ version 4.18 or later.

DB2JSONResultSet methods

The following methods are defined only for the IBM Data Server Driver for JDBC and SQLJ.

close
Format:
public void close()
  throws java.sql.SQLException

Closes a DB2JSONResultSet object.

getAsciiStream
Format:
public InputStream getAsciiStream()
  throws java.sql.SQLException

Returns a java.io.InputStream object that contains the contents of a DB2JSONResultSet object. If the contents of the object contain any non-ASCII characters, an encoding error is returned in the SQLException.

getCharacterStream
Format:
public Reader getCharacterStream()
  throws java.sql.SQLException

Returns a java.io.Reader object on which applications can call methods to read JSON documents incrementally.

getCurrentRow
Format:
public String getCurrentRow()
  throws java.sql.SQLException

Returns the current row of a DB2JSONResultSet object as a JSON snippet.

next
Format:
public String next()
  throws java.sql.SQLException

Moves the cursor position to the next row of a DB2JSONResultSet object. Returns false if there are no more rows to return.

toJSONString
Format:
public String toJSONString()
  throws java.sql.SQLException

Returns the contents of a DB2JSONResultSet object, starting with the current row, as a String. After this method is executed, the cursor points to the last row of the DB2JSONResultSet object. A subsequent next call returns false.