<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.*" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="java.sql.*" %>
<head>
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF8040}
-->
</style>
</head>
<body>
<%
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@127.0.0.1:1521:ctais";
String user="ctais2";
String password="oracle";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);;
String sqla=" select * from dm_xhlx ";
ResultSet rs1 = stmt.executeQuery(sqla);
out.println(rs1);
String src = "12345上解销号ABCDE";
%>
<form id="form1" name="form1" method="post" action="">
<table border="2" bordercolor="#000033">
<tr>
<td> <%=("1:"+src.getBytes("GB2312"))%> </td>
<td> <%=("2:"+new String(src.getBytes()))%> </td>
<td> <%=("6:"+new String(src.getBytes(),"GB2312"))%> </td>
<td> <%=("7:"+new String(src.getBytes(),"ISO-8859-1"))%> </td>
<td> <%=("8:"+new String(src.getBytes("GB2312")))%> </td>
<td> <%=("9:"+new String(src.getBytes("GB2312"),"GB2312"))%> </td>
<td> <%=("10:"+new String(src.getBytes("GB2312"),"ISO-8859-1"))%> </td>
<td> <%=("11:"+new String(src.getBytes("ISO-8859-1")))%> </td>
<td> <%=("12:"+new String(src.getBytes("ISO-8859-1"),"GB2312"))%> </td>
<td> <%=("13:"+new String(src.getBytes("iso-8859-1"),"gb2312"))%> </td>
<td> <%=("14:"+new String(src.getBytes("utf-8"),"gb2312"))%> </td>
<td> <%=("15:"+new String(src.getBytes("UTF-8"),"gb2312"))%> </td>
<td> <%=("16:"+new String(src.getBytes("utf-8"),"ISO-8859-1"))%> </td>
<td> <%=("17:"+new String(src.getBytes("UTF-16"),"gb2312"))%> </td>
<td> <%=("18:"+new String(src.getBytes("UTF-8")))%> </td>
<td> <%=("19:"+new String(src.getBytes("ISO-8859-1")))%> </td>
<td> <%=("20:"+new String(src.getBytes("ISO-8859-1"),"UTF-8"))%> </td>
<td> <%=("21:"+new String(src.getBytes("GB2312"),"UTF-8"))%> </td>
<td> <%=("22:"+new String(src.getBytes("US-ASCII"),"GB2312"))%> </td>
</tr>
<tr><td>asdfasdfasdfasdf</tr>
<% int i = 0;
while (rs1.next()) {
for (int column = 1; column < 3; column++) {
i++;
%>
<% System.out.println(new String(rs1.getString(column).getBytes()));
System.out.println(new String(rs1.getString(column).getBytes(),"GB2312"));
System.out.println(new String(rs1.getString(column).getBytes("ISO-8859-1"),"GBK"));
System.out.println(new String(rs1.getString(column).getBytes("GBK"),"ISO-8859-1"));
%>
<tr>
</tr>
<tr> <td> <%=("a1:"+rs1.getString(column))%> </td>
<td> <%=("1:"+rs1.getString(column).getBytes("GB2312"))%> </td>
<td> <%=("2:"+new String(rs1.getString(column).getBytes()))%> </td>
<td> <%=("6:"+new String(rs1.getString(column).getBytes(),"GB2312"))%> </td>
<td> <%=("7:"+new String(rs1.getString(column).getBytes(),"ISO-8859-1"))%> </td>
<td> <%=("8:"+new String(rs1.getString(column).getBytes("GB2312")))%> </td>
<td> <%=("9:"+new String(rs1.getString(column).getBytes("GB2312"),"GB2312"))%> </td>
<td> <%=("10:"+new String(rs1.getString(column).getBytes("GB2312"),"ISO-8859-1"))%> </td>
<td> <%=("11:"+new String(rs1.getString(column).getBytes("ISO-8859-1")))%> </td>
<td> <%=("12:"+new String(rs1.getString(column).getBytes("ISO-8859-1"),"GB2312"))%> </td>
<td> <%=("13:"+new String(rs1.getString(column).getBytes("iso-8859-1"),"gb2312"))%> </td>
<td> <%=("14:"+new String(rs1.getString(column).getBytes("utf-8"),"gb2312"))%> </td>
<td> <%=("15:"+new String(rs1.getString(column).getBytes("UTF-8"),"gb2312"))%> </td>
<td> <%=("16:"+new String(rs1.getString(column).getBytes("utf-8"),"ISO-8859-1"))%> </td>
<td> <%=("17:"+new String(rs1.getString(column).getBytes("UTF-16"),"gb2312"))%> </td>
<td> <%=("18:"+new String(rs1.getString(column).getBytes("UTF-8")))%> </td>
<td> <%=("19:"+new String(rs1.getString(column).getBytes("ISO-8859-1")))%> </td>
<td> <%=("20:"+new String(rs1.getString(column).getBytes("ISO-8859-1"),"UTF-8"))%> </td>
<td> <%=("21:"+new String(rs1.getString(column).getBytes("GB2312"),"UTF-8"))%> </td>
<td> <%=("22:"+new String(rs1.getString(column).getBytes("US-ASCII"),"GB2312"))%> </td>
</tr>
<% }
}
%>
</table>
</form>
</body>
</html>
乱码如下:
oracle.jdbc.driver.ScrollableResultSet@73cc11