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");
相关文档:
public static void main(String[] args)
{
Integer[] arrInt = new Integer[6];
arrInt[0] = 123;
arrInt[1] = 3453;
arrInt[2] = 345;
arrInt[3] = 23;
arrInt[4] = 11;
arrInt[5] = 345;
int temp = 0;
for (int i ......
Java串口通讯
串行通讯协议有很多种,像RS232,RS485,RS422,甚至现今流行的USB等都是串行通讯协议。而串行通讯技术的应用无处不在。可能大家见的最多就是电脑的串口与Modem的通讯。记得在PC机刚开始在中国流行起来时(大约是在90年代前五年),那时甚至有人用一条串行线进行两台电脑之间的 ......
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.font.TextAttribute;
import java.awt.image.BufferedImage;
import java.io.FileOutputStream;
import java.text.AttributedCharacterIterator;
import java.text. ......
今天开发,遇到了一个比较意外的问题。
1、问题描述:
String.split(”.”);//以点作为分隔符
结果得到的数组引用时,老报下标越界错误,后来测试也发现长度就是为零。
2、问题分析:
开始时,怀疑此 ......