I am trying to create a table in an sqlite database with the following statement:
CREATE TABLE contacts (
_id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL ,
PRIMARY KEY (_id)
);
It throws the following exception:
java.sql.SQLException: near "AUTO_INCREMENT": syntax error
at org.sqlite.core.NativeDB.throwex(NativeDB.java:397)
at org.sqlite.core.NativeDB._exec(Native Method)
at org.sqlite.jdbc3.JDBC3Statement.executeUpdate(JDBC3Statement.java:116)
at de.marcofriedmann.dbtest.DBController.createTables(DBController.java:64)
at de.marcofriedmann.dbtest.Main.main(Main.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
I am not able to find a syntax error. If i omit the auto_increment, everything works fine.
Any hints?
Aucun commentaire:
Enregistrer un commentaire