cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Driver to Read Multibyte(Japanese and Chinese) characters

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

first of all: What means doesn`t read - is there no output - unexcpected output ...

Former Member
0 Kudos

I mean , Using Statement object when I execute the query, it is executing and returning me the result. The result is saved to temp.txt, the temp.txt is opened in EDITPRO, but it is displaying only ????(question marks) instead of Japanese and Chinese characters.

I require, how to set the encoding or charcterset to excel driver so that it reads properly and saves the multibyte characters as they were in Excel.

Let me know if this clears doubt or I need to give more information to answer my question.

Your help is appreciated.

Thanks

Phani