I'm having issues with the PreparedStatement when connecting to a MS Access DB wither through the JDBC-ODBC bridge or through a thirdy party level 3 JDBC driver. What I have at this point looks like something along these lines:
Connection con = DriverManager.getConnection(url, username, password);
ResultSet rs;
Statement stat = con.createStatement();
String query = "INSERT (ABC) INTO TEST VALUES(?)";
PreparedStatement pstat = con.prepareStatement(query);
pstat.setInt(1, 1);
pstat.executeUpdate();
When I execute it this, the code throws an SQLException referring to a sytax error:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3104)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
at TCPREdition.main(TCPREdition.java:32)
Exception in thread "main"
What's going on here?
Connection con = DriverManager.getConnection(url, username, password);
ResultSet rs;
Statement stat = con.createStatement();
String query = "INSERT (ABC) INTO TEST VALUES(?)";
PreparedStatement pstat = con.prepareStatement(query);
pstat.setInt(1, 1);
pstat.executeUpdate();
When I execute it this, the code throws an SQLException referring to a sytax error:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3104)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
at TCPREdition.main(TCPREdition.java:32)
Exception in thread "main"
What's going on here?