易截截图软件、单文件、免安装、纯绿色、仅160KB

对oracle数据库中CLOB字段的相关操作


import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
 * 此处插入类型说明。
 * 创建日期:(2001/11/30 14:55:06)
 * @author:zhubin
 */
public class BLOBUtil {
/**
 * 功能说明:编码方式
 * 取值范围:
 * 依赖属性:
 * 最后修改时间:(2002-2-27 15:30:40)
 */
private static String codeSet;
/**
 * 此处插入方法说明。
 * 创建日期:(2001/11/30 14:58:15)
 * @return java.lang.String
 * @param result java.sql.ResultSet
 * @param index int
 */
public static String readBLOB(ResultSet result, int index) throws IOException,
 SQLException
{
String strValue = null;
// 对于SQL NULL,方法getBinaryStream将返回null
InputStream in = result.getBinaryStream(index);
if (in == null) {
return "";
}
byte[] ba = new byte[8192];
ByteArrayOutputStream b = new ByteArrayOutputStream();
int i;
while((i = in.read(ba)) != -1){
b.write(ba, 0, i);
}
try{
strValue = b.toString(codeSet);
}catch(Exception e){
strValue = b.toString();
}
return strValue;
}
/**
 * 此处插入方法说明。
 * 创建日期:(2001/11/30 14:59:52)
 * @return java.lang.String
 * @param result java.sql.ResultSet
 * @param name java.lang.String
 */
public static String readBLOB(ResultSet result, String name) throws IOException,
SQLException
{
String strValue;
// 对于SQL NULL,方法getBinaryStream将返回null
InputStream in = result.getBinaryStream(name);
if (in == null) {
return "";
}
byte[] ba = new byte[8192];
ByteArrayOutputStream b = new ByteArrayOutputStream();
int i;
while((i = in.read(ba)) != -1){
b.write(ba, 0, i);
}
try{
strValue = b.toString(codeSet);
}catch(Exception e){
strValue = b.t


相关文档:

Oracle 字符串长度函数


LENGTH calculates length using characters as defined by the input character set. 
LENGTHB uses bytes instead of characters. 
VSIZE returns the number of bytes in the internal representation of expr.
LENGTHC uses Unicode complete characters. 
LENGTH2 uses UCS2 codepoints. 
......

Oracle维护常用SQL语句汇总

Oracle维护常用SQL语句汇总
上一篇 / 下一篇  2008-09-04 11:25:01
查看( 1991 ) / 评论( 0 ) / 评分( 0 / 0 )
如何远程判断Oracle数据库的安装平台
select * from v$version;
查看表空间的使用情况
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_ ......

Java语言如何访问不同字符集的Oracle数据

一、java访问中文Oracle数据库上连接的US7ASCII数据库
1、读方法
public String convertLink_DB(String s) {
  if(s != null){
   try{
    byte[] b = s.getBytes();
    for(int i=0; i<b.length; i++){
     b[i] ......

Oracle 10G DataGuard

http://hi.baidu.com/firefly5002/blog/item/5b5719fcb5bd3e1d08244d11.html
Oracle 10G DataGuard
server A: 10.85.10.44 SID=mesdb
target server B: 10.85.10.43
oracle version:10.2.0.1
OS platform : windows 2003
Data Guard默认是maximize performance, 可以用以下语句来进行模式间的切换。
ALTER DATABASE ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号