oracle.sql.BLOB.getBinaryOutputStream()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(313)

本文整理了Java中oracle.sql.BLOB.getBinaryOutputStream()方法的一些代码示例,展示了BLOB.getBinaryOutputStream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BLOB.getBinaryOutputStream()方法的具体详情如下:
包路径:oracle.sql.BLOB
类名称:BLOB
方法名:getBinaryOutputStream

BLOB.getBinaryOutputStream介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

int primaryKeyId = getNextPrimaryKeyId();
PreparedStatement stmt1 = conn.prepareStatement(" insert into docTable values (?, ?, empty_blob()) ");
stmt1.setInt(1, primaryKeyId );
stmt1.setString(2, getDocumentTitle());
stmt1.executeUpdate();

PreparedStatement stmt2 = conn.prepareStatement(" select doc from docTable where id = ? for update ");
stmt2.setInt(1, primaryKeyId);
stmt2.execute();

OracleResultSet rset = (OracleResultSet)stmt2.getResultSet();
if (rset.next()) {
 BLOB document = rset.getBLOB("doc");
 document.trim(0);
 OutputStream os = document.getBinaryOutputStream();
 os.write(getDocumentToBeWrittenToDb());
 os.flush;
 os.close;
}

代码示例来源:origin: com.bbossgroups/bboss-persistent

outstream = blob.getBinaryOutputStream();
instream = new java.io.BufferedInputStream(new java.io.FileInputStream(file));
int bufferSize = blob.getChunkSize();

代码示例来源:origin: com.bbossgroups/bboss-persistent

outstream = blob.getBinaryOutputStream();

代码示例来源:origin: org.opencms/opencms-solr

/**
 * Generates an Output stream that writes to a blob, also truncating the existing blob if required.<p>
 * 
 * Apparently Oracle requires some non-standard handling here.<p>
 * 
 * @param res the result set where the blob is located in 
 * @param name the name of the database column where the blob is located
 * @return an Output stream from a blob
 * @throws SQLException if something goes wring
 */
public static OutputStream getOutputStreamFromBlob(ResultSet res, String name) throws SQLException {
  // TODO: perform blob check only once and store Oracle version in a static private member 
  // TODO: best do this during system startup / db init phase once
  Blob blob = res.getBlob(name);
  try {
    // jdbc standard
    blob.truncate(0);
    return blob.setBinaryStream(0L);
  } catch (SQLException e) {
    // oracle 9 & 8 (if using the same jdbc driver as provided by oracle9: ojdbc14.jar)
    ((oracle.sql.BLOB)blob).trim(0);
    return ((oracle.sql.BLOB)blob).getBinaryOutputStream();
  }
}

代码示例来源:origin: com.bbossgroups/bboss-persistent

outstream = blob.getBinaryOutputStream();
int bufferSize = blob.getChunkSize();
byte[] buffer = new byte[bufferSize];

代码示例来源:origin: com.bbossgroups/bboss-persistent

outstream = blob.getBinaryOutputStream();
int bufferSize = blob.getChunkSize();
byte[] buffer = new byte[bufferSize];

相关文章