基于Spring,CLOB/BLOB/String互转
2015-11-18 15:19
816 查看
String s1="Holle world!"; Clob c = new SerialClob(s1.toCharArray());//String 转 clob Blob b = new SerialBlob(s1.getBytes("GBK"));//String 转 blob // 也可以不传字符集名称,那么默认使用系统的 // Blob b = new SerialBlob(s1.getBytes()); String clobString = c.getSubString(1, (int) c.length());//clob 转 String String blobString = new String(b.getBytes(1, (int) b.length()),"GBK");//blob 转 String // 前面若没传入字符集名称,则这里也不需要传入,以免出错 // String blobString = new String(b.getBytes(1, (int) b.length()));
相关文章推荐
- Java 泛型中? super T和? extends T的区别
- struts2 实现自定义标签
- java 计算每个班级的总分
- java内存回收机制
- struts入门初步(一)
- Java 8特性探究(1):通往lambda之路_语法篇
- Java实现定时任务的三种方法
- java synchronized详解
- Selenium+Java自动化学习之路-----------环境搭建
- 在SpringMVC框架下提供dubbo服务(提供者)
- C,java语言中初始化问题
- java中按值传递与引用传递
- jetty各个版本对应的jdk版本
- Java将对象直接在数据库中存取的方法
- Java SE\EE\ME区别-下载什么jdk
- SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)
- Spring 中的TransactionTemplate
- Eclipse快捷键大全
- 深入浅出Java集合HashMap
- PhoneGap插件调用Java流程源码分析(一)