[code="java"][/code]
try
{
Class.forName(driverName);
dbConn = DriverManager.getConnection(dbURL, "", "");
Statement smt = dbConn.createStatement();
ResultSet set = smt.executeQuery("select * from [sheet1$]");
int i =0;
while (set.next())
{
System.out.print(i + "\t") ;
String str1 = set.getString(1);
String str2 = set.getString(2);
String str3 = set.getString(3);
if (str1 != null){
System.out.print(new String(str1.getBytes("ISO-8859-1") ,"gbk") + "\t") ;
}
if (str2 != null){
System.out.print(new String(str2.getBytes("ISO-8859-1") ,"utf-8") + "\t") ;
}
if (str3 != null){
System.out.println(new String(str3.getBytes("ISO-8859-1") ,"gb2312") + "\t") ;
}
i ++;
}
} catch (ClassNotFoundException e)
{
e.printStackTrace();
} catch (SQLException e)
{
e.printStackTrace();
} finally
{
[img]http://dl2.iteye.com/upload/attachment/0088/0295/95b4bfef-bd6a-38bd-a108-734d678d064e.gif[/img]
中文乱码,求解药 [code="java"][flash=200,200][img][/img][/flash][/code]