jdbc 读取oracle long raw 字段,里面存的是文本
2017-03-28 17:29
357 查看
jdbc 读取oracle long raw 字段,里面存的是文本
参考:
http://singlewolf.iteye.com/blog/278769 http://blog.csdn.net/restraint/article/details/7190265 http://blog.csdn.net/bq1073100909/article/details/49335491
基本上是流操作;
参考:
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 = new ByteArrayOutputStream(); int len = 0; byte[] bytes = new byte[1024]; try { while ((len = inputStream.read(bytes)) != -1) { // 将bcache中读取的input数据写入infoStream infoStream.write(bytes, 0, len); } } catch (IOException e1) { throw new Exception("输入流读取异常"); } finally { try { inputStream.close(); // 输入流关闭 } catch (IOException e) { throw new Exception("输入流关闭异常"); } } try { String result = infoStream.toString(DEFAULT_ENCODING); System.out.println(result); } catch (UnsupportedEncodingException e) { throw new Exception("输出异常"); } }
基本上是流操作;
相关文章推荐
- Oracle long raw 类型字段读取问题
- JDBC Oracle longraw 读取
- oracle里面的long,long raw,raw,clob,blob区别
- jdbc方式读取oracle的clob字段实例
- 利用oracle long类型字段,插入大文本
- 读取和写入大字段(Oracle,JDBC)
- oracle里面的long,long raw,raw,clob,blob区别 .
- 利用oracle long类型字段,插入大文本
- 【sql】oracle里面的long,long raw,raw,clob,blob区别
- Oracle 数据库中 Long 类型字段的读取
- oracle 读取blob大文本字段
- jdbc方式读取oracle的clob字段实例
- 利用oracle long类型字段,插入大文本
- jdbc basic operation,how to insert a long raw data
- 用Jdbc存取Oracle大字段对象
- oracle里面怎么查一个表中的日期字段的连续日期的缺少的日期
- JDBC从文件中读取内容写入CLOB字段的例子
- C#对Oracle BLOB字段的写入读取方法
- 在oracle中字段类型LONG的使用注意事项
- ORACLE数据库中主要字段类型的读写例子(包括:Long、Raw、Blob)