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

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("输出异常");
}
}

基本上是流操作;

最新文章

  1. redis 中文字符显示
  2. Codeforces Round #382 (Div. 2)C. Tennis Championship 动态规划
  3. 这一路走来,冷暖自知 (附算法demos)
  4. JSON.parse()和eval()区别
  5. [系统开发] Bind DNS 管理系统
  6. 使用iTextSharp来填充PDF模板文件
  7. HDU1372:Knight Moves(经典BFS题)
  8. 关于一点jeesite
  9. scalajs_初体验
  10. java 实现的c当中的几道题
  11. 201421123042 《Java程序设计》第4周学习总结
  12. cmd 【已解决】windows连接手机,运行adb devices提示“unauthorized”
  13. JSP页面传值出现中文乱码的问题
  14. 2017-11-11 Sa Oct How to open a browser in Python
  15. C#-变量类型(值类型、引用类型)
  16. 可变码率(英语:Variable bitrate,简称VBR)介绍
  17. nginx补丁格式说明(CVE-2016-4450为例)
  18. 【汇编】SI DI 的用法
  19. 【mybatis】mysql级联更新两个表或多张表的数据
  20. python学习之路 一 :编程语言介绍

热门文章

  1. pull的时候报错
  2. MySQL优化小方法
  3. php的string编码类型
  4. [Apple开发者帐户帮助]五、管理标识符(5)创建一个iCloud容器
  5. html body中的标签
  6. net .异步委托知识
  7. Android 概览屏幕
  8. 24 javascript best practices for beginner(only 23 finally)
  9. CentOS 7 中配置通过 daemon 模式启动的 Tomcat 8 服务
  10. VTK:VTK嵌入MFC成功