File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
JDBC and Relational Databases
Reading excel file using java
Joined: Dec 30, 2007
Sep 29, 2008 10:00:00
Am having an MS
file from which i have to read the data, i found the way by searching, i.e through
Now my problem is my column name is a date and if i give a select statement like
String query = "Select 28-Feb-08 from [Sheet1$]" ; ResultSet rs = stmnt.executeQuery( query );
this is giving me the error
java.sql.SQLException: [Microsoft][ODBC Excel Driver] Too few parameters. Expected 1.
Please help me! how can a read the with the column cell being a Date feild.
Joined: Oct 27, 2005
Sep 29, 2008 13:00:00
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 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
Joined: Oct 23, 2005
Sep 29, 2008 16:30:00
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?
[OCA 8 Book]
Joined: Oct 14, 2005
Sep 29, 2008 21:54:00
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.
Joined: Dec 30, 2007
Sep 29, 2008 23:39:00
Thanks Paul. Now the problem is solved!
I agree. Here's the link:
subject: Reading excel file using java
Reading date from excel file
Reading excel file with data in chinese language using jdbc
How to put Select Box in Excel column Cell using Jxl API
getting data from Excel
reading from excel files
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015