Does Operations on blob fields in Oracle produce a large number of redo operations?

Source: Internet
Author: User

Does Operations on blob fields in Oracle produce a large number of redo operations?

Check whether the blob field produces a large number of redo operations. The answer is no. Here is an experiment to test whether the Oracle database version is 11.2.0.1.0:

Install Oracle 11gR2 (x64) in CentOS 6.4)

Steps for installing Oracle 11gR2 in vmwarevm

Install Oracle 11g XE R2 In Debian
 
-- Create a table for testing
 
Create table test_blob
(
Id number,
Tupian blob
);

Import java. io. FileInputStream;
Import java. io. OutputStream;
Import java. SQL. Connection;
Import java. SQL. DriverManager;
Import java. SQL. ResultSet;
Import java. SQL. SQLException;
Import java. SQL. Statement;

Import oracle. SQL. BLOB;

Public class BlobExample {
Static final String driver_class = "oracle. jdbc. driver. OracleDriver ";
Static final String connectionURL = "jdbc: oracle: thin: @ 10.10.15.25: 1521: orcl ";
Static final String userID = "test ";
Static final String userPassword = "test ";

Private void insertTestBlob (){
Connection conn = null;
Statement stm = null;
ResultSet rs = null;
BLOB blob = null;
FileInputStream fin = null;
OutputStream out = null;
Try {
Conn = DriverManager. getConnection (connectionURL, userID, userPassword );
Stm = conn. createStatement ();
Conn. setAutoCommit (false );
String SQL = "insert into test_blob values (1, EMPTY_BLOB ())";
Cmd.exe cuteUpdate (SQL );
Rs = cmd.exe cuteQuery ("SELECT tupian FROM test_blob WHERE id = 1 for update ");
Fin = new FileInputStream ("d: // 20130317.jpg ");
Byte [] blobBuf = new byte [(int) fin. available ()];
Fin. read (blobBuf );
Fin. close ();

If (rs. next ()){
Blob = (oracle. SQL. BLOB) rs. getBlob (1 );
Out = blob. getBinaryOutputStream ();
Out. write (blobBuf );
Out. close ();
Conn. commit ();
}
} Catch (Exception e ){
E. printStackTrace ();
} Finally {
Try {
Rs. close ();
Stm. close ();
Conn. close ();
} Catch (SQLException e ){
E. printStackTrace ();
}
}
}
Public static void main (String args []) {
BlobExample blobClobExample = new BlobExample ();
BlobClobExample. insertTestBlob ();
}
}

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.