JDBC reads the Oracle long RAW field with text in it

Source: Internet
Author: User

JDBC reads the Oracle long RAW field with text in it

Reference:

http://singlewolf.iteye.com/blog/278769

http://blog.csdn.net/restraint/article/details/7190265

http://blog.csdn.net/bq1073100909/article/details/49335491

String sql = "Select condition from tbl t where t.a =?" and t.b =? "; PreparedStatement Statement=hebsgconn.preparestatement (SQL); Statement.setstring (1, "20170305"); Statement.setint (2, 146897); ResultSet ResultSet=Statement.executequery (); if(Resultset.next ()) {InputStream InputStream= Resultset.getbinarystream ("condition"); Bytearrayoutputstream Infostream=NewBytearrayoutputstream (); intLen = 0; byte[] bytes =New byte[1024]; Try {                     while(len = inputstream.read (bytes))! =-1) {                        //writes input data read in Bcache to InfostreamInfostream.write (Bytes, 0, Len); }                } Catch(IOException E1) {Throw NewException ("input stream read exception"); } finally {                    Try{inputstream.close ();//input stream off}Catch(IOException e) {Throw NewException ("Input stream close exception"); }                }                Try{String result=infostream.tostring (default_encoding);                SYSTEM.OUT.PRINTLN (result); } Catch(unsupportedencodingexception e) {Throw NewException ("Output Exception"); }            }

is basically a flow operation;

JDBC reads the Oracle long RAW field with text in it

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.