Java Blob类型和String类型相互转换

时间:2016-05-23 18:56:58   收藏:0   阅读:746
  1. 1、String 转 Blob:  
  2.   
  3.     String content = "Hello World!";  
  4.   
  5.     Blob blob = Hibernate.createBlob(content.getBytes());  
  6.   
  7. 2、Blob 转 String:  
  8.   
  9.     Blob blob;  
  10.   
  11.     try{  
  12.          String content = new String(blob.getBytes((long)1, (int)blob.length()));  
  13.     } catch(SQLException e) {  
  14.          e.printStackTrace();  
  15.     } 

原文:http://www.cnblogs.com/xiaoqisfzh/p/5520821.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!