Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

INSERT problem

 
Padraig Joseph
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Craig Demyanovich
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Craig, I thought I'd never solve that one!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic