2008-6-11 18:01
yl1998
oracle9i乱码问题,oracle817显示正常
ORACLE: ORACLE9.2.0.7
NLS_NCHAR_CHARACTERSET: AL16UTF16
NLS_CHARACTERSET: WE8ISO8859P1
JAVA代码如下:
<%@ page import="java.sql.,java.text.,java.util.*" errorPage="" %>
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%
String sDBDriver = "oracle.jdbc.driver.OracleDriver";
String sConnStr = "jdbc:oracle:thinlocalhost:1521:oracle";
Connection conn = null;
ResultSet rs = null;
Statement stmt = null;
Class.forName(sDBDriver);
try {
conn = DriverManager.getConnection(sConnStr, "user", "password");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from table1");
while (rs.next()) {
out.println(":" + "
");
}
conn.close();
}
catch (Exception e){
String err= e.getMessage();
String des = new String(err.getBytes("GBK"),"ISO8859-1");
out.println (e.getMessage () + "
");
out.println("" +des + "");
out.println("
");
out.println("" +err + "");
}
%>
注:1. table1不存在,主要想输出oracle 错误提示,
2. oracle 817 显示正常
想输出oracle 错误提示,但
des输出一直是乱码,高人指点一下
2008-6-12 00:12
justforregister
String des = new String(err.getBytes("GBK"),"ISO8859-1");
这是干嘛呢? 凭啥这么转?
2008-6-12 08:44
yl1998
那应该怎么转?
2008-6-12 09:10
dearmeiw
[quote]原帖由 [i]justforregister[/i] 于 2008-6-12 00:12 发表 [url=http://www.itpub.net/redirect.php?goto=findpost&pid=10635346&ptid=1003870][img]http://www.itpub.net/images/common/back.gif[/img][/url]
String des = new String(err.getBytes("GBK"),"ISO8859-1");
这是干嘛呢? 凭啥这么转? [/quote]
老师就这么教的,不这么转他怎么转::-):
2008-6-12 09:23
yl1998
感觉是转码这一段有问题,817是ISO8859-1
9i 感觉不是这个字符集
2008-6-14 09:34
yl1998
没有人能解决这个问题吗?
2008-6-23 17:14
alfah
看看http头
2008-6-23 23:50
justforregister
[quote]原帖由 [i]yl1998[/i] 于 2008-6-12 09:23 发表 [url=http://www.itpub.net/redirect.php?goto=findpost&pid=10636523&ptid=1003870][img]http://www.itpub.net/images/common/back.gif[/img][/url]
感觉是转码这一段有问题,817是ISO8859-1
9i 感觉不是这个字符集 [/quote]
感觉不是,那就去找正确的字符集啊
2008-6-23 23:50
justforregister
[quote]原帖由 [i]alfah[/i] 于 2008-6-23 17:14 发表 [url=http://www.itpub.net/redirect.php?goto=findpost&pid=10750674&ptid=1003870][img]http://www.itpub.net/images/common/back.gif[/img][/url]
看看http头 [/quote]
和这个有关吗
页:
[1]

Powered by ITPUB论坛