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] = (byte)(b[i]-128);
}
return new String(b, "gb2312");
}catch(Exception e){
e.printStackTrace();
return "";
}
}
return "";
}
2、写方法
public String convertLink_DB(String s) {
if(s != null){
try{
byte[] b = s.getBytes();
for(int i=0; i<b.length; i++){
b[i] = (byte)(b[i]+128);
}
return new String(b, "gb2312");
}catch(Exception e){
e.printStackTrace();
return "";
}
}
return "";
}
一、java访问英文Oracle数据库
1、读
new String(s, "gb2312");
2、写
new String(s, "8859-1");
相关文档:
JAVA中基本变量共包括:byte,short,int,long,float,double,char,boolean,在程序中用的最普遍,最多,但是它们的一些关键也经常被我们所忽略,我今天总结了一下,贴在这里。。。
1.
变量定义:
一个由标识符定义的数据项,包括类型、名称和值三个部分
2.
变量分类:
类 ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
最近研究了下分页,做个总结。
1)数据库操作类,做简单封装 DB.java
package Test;
import java.sql.*;
public class DB {
// 加载驱动
static {
try {
Class.f ......
package fileTest;
import java.io.*;
public class FileOperate {
public FileOperate() {
}
public static void main(String args[]){
// newFolder("D:/100");
moveFile("e:/978 ......