Trouble inserting into an excel sheet using jdbc
843859Aug 26 2008 — edited Aug 26 2008I'm trying to access an excel file using jdbc. doing it first time and things aren't working good.
When the excel file is closed, changes made to it are not reflected.. while if the file is open, it is updated when i run the code.
Besides, a few columns are not inserted into. For a few of them, an SQLException is thrown and "Data type mismatch in criteria expression." is reported. while in others.. it simply reports a syntax error.
My excel sheet has the following columns -
date , debit, credit, desc, total, balance
It shows a syntax error when i insert into date. i used a prepared statement and tried a setInt, setString, setDate for the column. none worked.
It reports a Data type mismatch error when i insert a string in to debit. that is.. when i do a setString.
I tried getting the ResultSetMetaData and got the column types. All columns returned varchar. i don't understand why it would report any type mismatch. how does it determine datatype for cols already existing in the excel sheet?