aspose file tools
The moose likes JDBC and Relational Databases and the fly likes reading excel file using jdbc  [help me] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "reading excel file using jdbc  [help me]" Watch "reading excel file using jdbc  [help me]" New topic
Author

reading excel file using jdbc [help me]

vijayk kumar
Greenhorn

Joined: Jul 29, 2006
Posts: 18
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

Joined: Jun 22, 2005
Posts: 86
>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.
 
subject: reading excel file using jdbc [help me]