Menu

net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.1 type not found or user lacks privilege: COUNTER

Help
2019-03-03
2019-03-03
  • Abdelrazek Nageh

    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.1 type not found or user lacks privilege: COUNTER
    at net.ucanaccess.jdbc.UcanaccessStatement.executeUpdate(UcanaccessStatement.java:221)
    at Main.main(Main.java:42)
    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:498)
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
    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:498)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
    Caused by: java.sql.SQLException: type not found or user lacks privilege: COUNTER
    at net.ucanaccess.jdbc.AbstractExecute.addDDLCommand(AbstractExecute.java:182)
    at net.ucanaccess.jdbc.AbstractExecute.executeBase(AbstractExecute.java:205)
    at net.ucanaccess.jdbc.ExecuteUpdate.execute(ExecuteUpdate.java:50)
    at net.ucanaccess.jdbc.UcanaccessStatement.executeUpdate(UcanaccessStatement.java:219)
    ... 12 more
    
    Code :
    LocalDate ld = LocalDate.now();
    int day = ld.getDayOfMonth();
    if(day == 3){
    System.out.println("initialize Serialn count 1");
    DB db = new DB();
    Connection con = db.getConnection_F_DB();
    try{
    int ps = 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(SQLException sql){
    sql.printStackTrace();
    }
    }
    
     

    Last edit: Abdelrazek Nageh 2019-03-03
  • Gord Thompson

    Gord Thompson - 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.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.