Following is my piece of code. But when I execute following exception is generated. net.ucanaccess.jdbc.UcanaccessSQLException: unexpected token: SMALLINT
String sql= "CREATE TABLE "+emailId.getText()+"Inbox (id integer PRIMARY KEY AUTOINCREMENT,fromId varchar(50), InMsgs varchar(200))";
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
con=DriverManager.getConnection("jdbc:ucanaccess://path/Email.accdb");
st=con.createStatement();
con.setAutoCommit(false);
check2=st.executeUpdate(sql);
I'm using MSAccess database, Java SE 8 in netbeans with UCanAccess 2.0.9.4. What is the problem
Your query should be like this
CREATE TABLE "+emailId.getText()+"Inbox
(id AUTOINCREMENT PRIMARY KEY ,
fromId varchar(50),
InMsgs varchar(200))
AUTOINCREMENT is already specified so no need for 'Integer'. Also Primary Key
key word should come after the datatype.