Insert database clob type

Source: Internet
Author: User
Java. SQL. preparedstatement pstmt = NULL;
Resultset rs = NULL;
String query = "";

Conn. setautocommit (false );
Query = "insert into clobtest_table (ID, picstr) values (?, Empty_clob ())";
Java. SQL. preparedstatement pstmt = conn. preparestatement (query );
Pstmt. setstring (1, "001 ");
Pstmt.exe cuteupdate ();
Pstmt = NULL
Query = "select picstr from clobtest_table where id = '001' for update ";
Pstmt = con. preparestatement (query)
Rs = pstmt.exe cutequery ();

Oracle. SQL. clob clobtt = NULL;
If (Rs. Next ()){
Clobtt = (Oracle. SQL. clob) Rs. getclob (1 );
Writer wR = clobtt. getcharacteroutputstream ();
Wr. Write (strtmp );
Wr. Flush ();
Wr. Close ();
Rs. Close ();
Con. Commit ();
As shown in the preceding example
You are writing a problem. COLB needs to use stream to read and write data. byte [] doesn't work.

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: 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.