| Author |
Reading excel file with data in chinese language using jdbc
|
Neil Jen
Greenhorn
Joined: Aug 30, 2011
Posts: 3
|
|
Hi All,
i am having one problem. I have an excel sheet with data in chinese, i am trying to fetch data from this file using jdbc but i am getting the error message as "[Microsoft][ODBC Excel Driver]COUNT field incorrect"
here is my query : select distinct 地区 from [data1$]
|
 |
Ranga Medagoda
Greenhorn
Joined: Sep 25, 2009
Posts: 6
|
|
|
If you could provide some more info, such as a code snippet. It could be more easier to answer. Hope you are using the correct driver.
|
 |
Neil Jen
Greenhorn
Joined: Aug 30, 2011
Posts: 3
|
|
Ranga Medagoda wrote:If you could provide some more info, such as a code snippet. It could be more easier to answer. Hope you are using the correct driver.
here is the code snippet i am trying to execute:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc river={Driver do Microsoft Excel(*.xls)};DriverID=22;READONLY=false;DBQ=D:\\temp\\DataSource\\chinese.xls", "", "");
Statement st = con.createStatement();
String query = "Select [地区], [办公室], [产品], [业务部], [打开] from [data1$]";
ResultSet rs = st.executeQuery(query);
i also tried executing above code by removing square brackets from query, tried just for one column. And one more thing i notice is yesterday i was getting error ""[Microsoft][ODBC Excel Driver]COUNT field incorrect", today i added "-Dfile.encoding=UTF-8" to my eclipse.ini since then i am getting this error "[Microsoft][ODBC Excel Driver] Too few parameters. Expected 1" for same code. Its very confusing. I am using microsoft excel driver, i am able to fetch data from excel file with data in english with same code and driver
|
 |
Scott Selikoff
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3666
|
|
|
Not sure of the direct solution, but one workaround would be to "SELECT *" in your query than use integer values in your rs.get<Object>() calls.
|
My Blog: Down Home Country Coding with Scott Selikoff
|
 |
Neil Jen
Greenhorn
Joined: Aug 30, 2011
Posts: 3
|
|
Scott Selikoff wrote:Not sure of the direct solution, but one workaround would be to "SELECT *" in your query than use integer values in your rs.get<Object>() calls.
Hey Scott thanks for your reply and consideration. I tried using "SELECT *" in my query, by this i was able to fetch data but it is not in proper format it shows ??? instead of chinese characters. i am not able to understand whether its problem while fetching data or printing data on console.
|
 |
 |
|
|
subject: Reading excel file with data in chinese language using jdbc
|
|
|