Hi,
We have a japanese database which stores the characters in Shift-JIS format. Then I use JDBC API to extract the information from the database and then dump it into a html. When I visit this dynamic page, the html contains some strange characters, but not the japanese character.
I could view different japanese pages properly. When I run "SELECT dump( column2,16 ) FROM MYTABLE WHERE column1='3001';", I get "Typ=1 Len=7: c4,d7,cc,de,d9,2f,46".
I don't think the problem is in displaying the characters. I believe the problem is when extracting the characters using JDBC. Can someone suggest what to do?
Thanks,
Prasanna
This is the jsp file we have......
##########################
##########
##
<%@ page import="java.io.*,java.uti
l.*,java.s
ql.*,java.
net.*, java.sql.*,java.text.*" errorPage="error.jsp" %>
<html>
<title>QUEUE</title>
<head>
<meta http-equiv="content-type" content="text/html;charset
=shift_jis
">
<meta http-equiv="content-Langua
ge" content="ja">
<meta http-equiv="refresh" content="900">
</head>
<body>
<div align=center>
<table border=10 width=100%">
<tr bgcolor="#3399FF"><td align=center>
<font face=Arial color="#ffffff" size=2><b>Queue</b></font>
</tr>
</table>
<%
String column1="";
String column2 = "";
String column3 = "";
String column4 = "";
String column5 = "";
%>
<table border=10 width=100% cellspacing=0>
<tr>
<td align=center valign=bottom bgcolor = #FF9900><B> Column1 </B></td>
<td align=center valign=bottom bgcolor = #FF9900><B> Column2 </B></td>
<td align=center valign=bottom bgcolor = #FF9900><B> Column3 </B></td>
<td align=center valign=bottom bgcolor = #FF9900><B> Column4 </B></td>
<td align=center valign=bottom bgcolor = #FF9900><B> Column5 </B></td>
</tr>
<%
Connection conn = null;
try{
Class.forName("oracle.jdbc
.driver.Or
acleDriver
");
String connectString = "jdbc:oracle:thin:@xx.xx.x
x.xx:INDBD
9";
conn = DriverManager.getConnectio
n(connectS
tring,"USE
RID","PASS
WORD");
Statement stmt = null;
ResultSet rset = null;
String sqlquery = "SELECT column1, column2, column3, column4, column5 " +
"FROM MYTABLE WHERE column1 = '3001'";
stmt = conn.createStatement();
rset = stmt.executeQuery(sqlquery
);
while(rset.next()) {
column1 = new String(rset.getBytes(1), "SJIS");
column2 = new String(rset.getBytes(2), "SJIS");
column3 = new String(rset.getBytes(3), "SJIS");
column4 = new String(rset.getBytes(4), "SJIS");
column5 = new String(rset.getBytes(5), "SJIS");
%>
<tr>
<td align=center valign=bottom bgcolor = #FFFFCC> <%= column1 %></td>
<td align=center valign=bottom bgcolor = #FFFFCC> <%= column2 %></td>
<td align=center valign=bottom bgcolor = #FFFFCC> <%= column3 %></td>
<td align=center valign=bottom bgcolor = #FFFFCC> <%= column4 %></td>
<td align=center valign=bottom bgcolor = #FFFFCC> <%= column5 %></td>
</tr>
<%
rset.close();
stmt.close();
conn.close();
}catch(Exception e) {
e.printStackTrace();
}
%>
</table>
</body>
</html>
##########################
##########