没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
本地的数据库是oracle.字符集是zhs16gbk,
远程数据的字符集是us7ascii,
这样提取过来的值是乱码。
实现办法:
插入一条记录:
Connection conn=null;
PreparedStatement pstmt = null;
try {
String strSql="insert into tabA(A,B) values(11&121)";
conn=ds.getConnection();
strSql = new String(strSql.getBytes("GBK"), "ISO-8859-1");
pstmt = conn.prepareStatement(strSql);
pstmt.executeUpdate();
}
catch (Exception e) {
} finally {
rs.close;
pstmt.close;
coon.close;
}
查询一条记录:
Connection conn=null;
PreparedStatement pstmt = null;
ResultSet rs=null;
try {
String sql="select B from tabA where A=1111";
conn=ds.getConnection();
Sql = new String(strSql.getBytes("GBK"), "ISO-8859-1");
pstmt = conn.prepareStatement(sql);
远程数据的字符集是us7ascii,
这样提取过来的值是乱码。
实现办法:
插入一条记录:
Connection conn=null;
PreparedStatement pstmt = null;
try {
String strSql="insert into tabA(A,B) values(11&121)";
conn=ds.getConnection();
strSql = new String(strSql.getBytes("GBK"), "ISO-8859-1");
pstmt = conn.prepareStatement(strSql);
pstmt.executeUpdate();
}
catch (Exception e) {
} finally {
rs.close;
pstmt.close;
coon.close;
}
查询一条记录:
Connection conn=null;
PreparedStatement pstmt = null;
ResultSet rs=null;
try {
String sql="select B from tabA where A=1111";
conn=ds.getConnection();
Sql = new String(strSql.getBytes("GBK"), "ISO-8859-1");
pstmt = conn.prepareStatement(sql);
冷风飕飕
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页