Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading excel file using java

 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • 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: 20751
68
Chrome Eclipse IDE Java Windows
  • 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: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • 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
Posts: 21576
33
Eclipse IDE Firefox Browser MySQL Database
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul. Now the problem is solved!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic