This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Reading excel file using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Reading excel file using java" Watch "Reading excel file using java" New topic
Author

Reading excel file using java

Bharadwaj Adepu
Ranch Hand

Joined: Dec 30, 2007
Posts: 99
Am having an MS Excel file from which i have to read the data, i found the way by searching, i.e through JDBC.
Now my problem is my column name is a date and if i give a select statement like

this is giving me the error

Please help me! how can a read the with the column cell being a Date feild.


SCJP 1.5
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

You could try putting the date between [ and ]. That usually works with Microsoft products in combination with databases (SQL Server, Access, etc).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

Use a Prepared Statement! Then you never have to worry about date formatting. Although I am curious why you're selecting a value with date as the field name, wouldn't "SELECT * FROM ... WHERE date='28-Feb-2008'" be more appropriate?


My Blog: Down Home Country Coding with Scott Selikoff
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

If the column name is really a date cell, that probably isn't the column name. I suggest you use a "SELECT * FROM ..." query and use the ResultSetMetaData object to find out the actual column names.
Bharadwaj Adepu
Ranch Hand

Joined: Dec 30, 2007
Posts: 99
Thanks Paul. Now the problem is solved!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading excel file using java
 
Similar Threads
reading from excel files
How to put Select Box in Excel column Cell using Jxl API
Reading date from excel file
getting data from Excel
Reading excel file with data in chinese language using jdbc