It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes INSERT problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "INSERT problem" Watch "INSERT problem" New topic

INSERT problem

Padraig Joseph

Joined: May 07, 2002
Posts: 13
Can anyone see a Syntax error in the following INSERT statement?
INSERT INTO tblGenericDate (systemID, boundBy, from, to, considerLast, calculateWhen) VALUES (24, 'calendarYear', 0, 0, 2, 'quarterly')
The error is:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in
INSERT INTO statement.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
There is nothing wrong with the syntax of the statement although there might be some underlying problem. Try t find out some more about the error:
You could have a column name spelled wrong or be trying to insert the wrong type of data into a column. It might be looking for a semi-colon at the end of the statement too (depending on the DB).

Craig Demyanovich
Ranch Hand

Joined: Sep 25, 2000
Posts: 173
"from" is a reserved word in MS Access. You can find a reserved word list for MS Access 2002 here. It points to earlier versions as well.
Padraig Joseph

Joined: May 07, 2002
Posts: 13
Thanks Craig, I thought I'd never solve that one!
I agree. Here's the link:
subject: INSERT problem
It's not a secret anymore!