This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading excel file using java

 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try putting the date between [ and ]. That usually works with Microsoft products in combination with databases (SQL Server, Access, etc).
 
Scott Selikoff
author
Saloon Keeper
Posts: 3896
16
Eclipse IDE Flex Google Web Toolkit
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Paul Clapham
Sheriff
Pie
Posts: 20185
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul. Now the problem is solved!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic