Hi,,,,
The Query => "ALTER TABLE General_db ALTER COLUMN Serialn COUNTER(1,1);" running okey in access Design Query area but when i did that Programmatically this Error happened :
Error:
net.ucanaccess.jdbc.UcanaccessSQLException:UCAExc:::4.0.1typenotfoundoruserlacksprivilege:COUNTERatnet.ucanaccess.jdbc.UcanaccessStatement.executeUpdate(UcanaccessStatement.java:221)atMain.main(Main.java:42)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:498)atcom.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)atcom.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:498)atsun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)Causedby:java.sql.SQLException:typenotfoundoruserlacksprivilege:COUNTERatnet.ucanaccess.jdbc.AbstractExecute.addDDLCommand(AbstractExecute.java:182)atnet.ucanaccess.jdbc.AbstractExecute.executeBase(AbstractExecute.java:205)atnet.ucanaccess.jdbc.ExecuteUpdate.execute(ExecuteUpdate.java:50)atnet.ucanaccess.jdbc.UcanaccessStatement.executeUpdate(UcanaccessStatement.java:219)...12moreCode:LocalDateld=LocalDate.now();intday=ld.getDayOfMonth();if(day==3){System.out.println("initialize Serialn count 1");DBdb=newDB();Connectioncon=db.getConnection_F_DB();try{intps=con.createStatement().executeUpdate("ALTER TABLE General_db ALTER COLUMN Serialn COUNTER(1,1);");if(ps==0){System.out.println("Table altered successfully.");}else{System.out.println("Table altered not Success");}}catch(SQLExceptionsql){sql.printStackTrace();}}
Last edit: Abdelrazek Nageh 2019-03-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Access only lets us change (i.e., ALTER) a column to type COUNTER if the table contains no rows, so that operation would effectively be a DROP COLUMN followed by an ADD COLUMN. Unfortunately, UCanAccess does not (yet) support DROP COLUMN.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,,,,
The Query => "ALTER TABLE General_db ALTER COLUMN Serialn COUNTER(1,1);" running okey in access Design Query area but when i did that Programmatically this Error happened :
Last edit: Abdelrazek Nageh 2019-03-03
Access only lets us change (i.e., ALTER) a column to type
COUNTER
if the table contains no rows, so that operation would effectively be a DROP COLUMN followed by an ADD COLUMN. Unfortunately, UCanAccess does not (yet) support DROP COLUMN.