java.sql.SQLException

My program is compiling correctly with out any errors. when i try to run it this error occurred :

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in

INSERT INTO statement.

at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)

at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)

at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)

at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)

at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)

at DataManipulation.main(DataManipulation.java:16)

sample:

class example1

{

public static void main(String args[])

{

String url="jdbc dbc:mysource";

String query="SELECT sname,fname,lname FROM emp";

.......

......

........

myStatement.executeUpdate("insert into student" + "VALUES('aa','marvin','bon',56)");

........

.......

[993 byte] By [frant] at [2007-9-26 4:29:07]
# 1

Hi,

Can you please check the following

(i)Are there 4 columns in the table

(ii) Are the first three are strings and the last an int

(iii) columns in the correct order

Please check the above and let me know.

Anil

Developer Technical Support

Sun Microsystems,India.

http://www.sun.com/developers/support

ramanil_indts at 2007-6-29 17:40:13 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Maybe there's one space missing..... before VALUES... myStatement.executeUpdate("insert into student" + " VALUES('aa','marvin','bon',56)");You're welcome!!
vissi at 2007-6-29 17:40:13 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Hi , One good way to find out the problem is to print out ur SQL as it is built in the course of the application, and then try it with the SQL editor for ur database.Missing commas,apostrophes and other funny things wudnt be hard to find then.
kk77 at 2007-6-29 17:40:13 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...