Skip to Content
0
Former Member
Nov 18, 2008 at 12:30 PM

Excel Driver to Read Multibyte(Japanese and Chinese) characters

47 Views

I am working on Internationalization of application. I have a requirement to read the Japanese and Chinese characters from Excel sheet and save in Database table. The Microsoft Excel driver is not supporting the multibyte characters. The code snippet is

Connection conn = null;

String infile="ChinJap.xls";

String tabSheet = "multibyte";

try {

Properties info = new Properties();

info.put("charSet", "utf-8");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DriverID=22;READONLY=false;"+ "DBQ=" + infile,info)";

Statement stmt = conn.createStatement();

ResultSet rs = stmt.executeQuery("select English,Japanese,Chinese from [" + tabSheet+ "$]");

FileOutputStream fos=new FileOutputStream("temp.txt");

if(rs.next()){

do{

String temp = rs.getString(2)+"\n";

fos.write(temp.getBytes());

}while(rs.next());

}

The above code is not displaying Japanese and Chinese characters after reading from the Excel sheet that has the Japanse and chinese data in a sheet.

Any help in this regard is appreciated.

Thanks in advance