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