aspose file tools*
The moose likes JDBC and the fly likes INSERT problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "INSERT problem" Watch "INSERT problem" New topic
Author

INSERT problem

Padraig Joseph
Greenhorn

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
Padraig
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:
System.out.println(e.getSQLState());
System.out.println(e.getErrorCode());
System.out.println(e.getMessage());
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).


Dave
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.
Craig
Padraig Joseph
Greenhorn

Joined: May 07, 2002
Posts: 13
Thanks Craig, I thought I'd never solve that one!
 
wood burning stoves
 
subject: INSERT problem