• Post Reply Bookmark Topic Watch Topic
  • New Topic

reading excel file using jdbc [help me]  RSS feed

 
vijayk kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,

problem:
at the time of retrieving records in excel sheet i am getting null values for the alpha numeric values in the excel sheet
example:
one of the field in excel sheet is "n38w"
while printing on the console null value appearing in the place of this field .
connection = DriverManager.getConnection("jdbcdbcriver={Microsoft Excel Driver (*.xls)};DBQ=" + fileName);


String query="Select [stock_no],[shape],[size],[color],[clarity],[rap-price],[ttl rap price],[whlrapdiscount],[ttlwhsl price],[retailrap discount],[retail price],[ttl retail price],[cert],[depth],[table],[girdle],[culet],[polish],[sym],[fluor],[crown],[pavil],[meas],[comment],[stones],[certno],[rapcode] from[Fortune Inv$]";
//[whlsprice],,, from[Fortune Inv$]";

System.out.println(rs.getString(1)); Here null value is getting
 
Wei Dai
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>i am getting null values for the alpha numeric values in the excel sheet
> System.out.println(rs.getString(1)); Here null value is getting
You can try rs.getInt(1). MS Excel ODBC driver has bug in detecting between numeric values and string values.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!