• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1327
  • Last Modified:

Excel JDBC/ODBC "Syntax error in field definition"

Hi experts,

In my Java program, I export results to an Excel sheet, using the jdbc-odbc bridge.
It always manages to connect (ie. create the xls file), but then when executing the Create statement, it fails sometimes,
 giving "java.sql.SQLException: [Microsoft][ODBC Excel Driver] Syntax error in field definition."

create table nameofTable (name TEXT, phone TEXT, amt TEXT, date TEXT, Status TEXT, Result TEXT, CallStart TEXT, CallEnd TEXT, Duration TEXT);

so once again:  connect statement always works.  create statement doesnt work sometimes, even though syntax is the same as when it does work.

sorry its so vague...  but any ideas?
Thanks
Dan
0
dbrownell83
Asked:
dbrownell83
  • 2
  • 2
1 Solution
 
objectsCommented:
Looks like some of your field names are reservered words (eg. date)
Try changing your field names, or try wrapping them in []  eg. [date]
0
 
dbrownell83Author Commented:
thanks i knew it was something stupid
0
 
objectsCommented:
stupid is such a harsh term :)
0
 
dbrownell83Author Commented:
they won't let me write harsher terms, i dont think
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now