title: Java SQL Syntax error in INSERT INTO statement
body: <p>I am trying to insert the data below into a table that has the columns ID[autoNumber], type[text], to[text], from[text], message[text] and attachmentLoc[text]</p>
  
  <p>So the autonumber is generated I insert them supplying the column names. When it runs the console prints out:</p>
  
  <pre><code>java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
  at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
  at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
  at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3149)
  at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:216)
  at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:138)
  at MultiEchoServer.saveMessage(MultiEchoServer.java:147)
  at ClientHandler.run(MultiEchoServer.java:409)
  </code></pre>
  
  <p>The code that is bringing the error is :</p>
  
  <pre><code>try
      {
          String sql = "INSERT INTO Messages (type, to, from, message, attachmentLoc) VALUES(?,?,?,?,?)";     
          PreparedStatement stmt = database.prepareStatement(sql);
          stmt.setString(1, message.getType());
          stmt.setString(2, message.getTo());
          stmt.setString(3, message.getFrom());
          stmt.setString(4, message.getMessage());
          stmt.setString(5, attachmentLoc);
          stmt.executeUpdate();
      }
      catch (SQLException e)
      {
          System.out.println("Could not perform statement");
          e.printStackTrace();
      }
  </code></pre>
  
  <p>Thanks for your help</p>