cancel
Showing results for 
Search instead for 
Did you mean: 

UltraLiteJ Error[-121]: Permission denied: set read-only

Former Member
0 Kudos

Hi,

I am new to SAP Anywhere and I am working with UltraLite.

I used "UltraLiteJ16.jar" for J2se (\SQL Anywhere 16\UltraLite\UltraLiteJ\J2se\UltraLiteJ16.jar) in my code.

I changed the example given in the below link (Example: Managing database operations on an Android smartphone) to work with j2se instead of Android.

http://dcx.sap.com/index.html#sa160/en/ulj/ulj-dbmanagement-android-sample.html

The changes I made:

instead of "DatabaseManager.createConfigurationFileAndroid ()" method I used "DatabaseManager.createConfigurationFile ()"

public void createDb(String strFilename) throws ULjException {

      ConfigFile config = DatabaseManager.createConfigurationFile(strFilename);

      try {

            conn = DatabaseManager.connect(config);

      } catch (ULjException ex) {

            conn = DatabaseManager.createDatabase(config);

            System.err.println("Successfully created a new database");

    

              for(int i = 0; i< stmt.length; i++) {

                  ExecuteSQLStatement(stmt[i]);

              }

      }

  }

I have attached the java code also (since JAVA files are not allowed, i renamed UltralitejDemo.java to UltralitejDemo.txt).

When I ran the program, Creating table, Inserting and deleting data working fine but Update giving following error:

com.ianywhere.ultralitej16.implementation.JrException: UltraLiteJ Error[-121]: Permission denied: set read-only

  at com.ianywhere.ultralitej16.implementation.JrException.throwException(Unknown Source)

  at com.ianywhere.ultralitej16.implementation.JrException.throwException(Unknown Source)

  at com.ianywhere.ultralitej16.implementation.JrValue.checkReadOnly(Unknown Source)

  at com.ianywhere.ultralitej16.implementation.JrValue.setInternal(Unknown Source)

  at com.ianywhere.ultralitej16.implementation.JrRow.setValue(Unknown Source)

  at com.ianywhere.ultralitej16.implementation.PrepStmtChanger.copyValuesToRow(Unknown Source)

  at com.ianywhere.ultralitej16.implementation.PrepStmtUpdate.execute(Unknown Source)

  at sql.anywhere.ultralitej.demo.UltralitejDemo.UpdateDepartment(UltralitejDemo.java:123)

  at sql.anywhere.ultralitej.demo.UltralitejDemo.<init>(UltralitejDemo.java:44)

  at sql.anywhere.ultralitej.demo.UltralitejDemo.main(UltralitejDemo.java:198)

I need help/suggestions to solve this problem.

Thanks and Regards

Shashi

Accepted Solutions (1)

Accepted Solutions (1)

chris_keating
Advisor
Advisor
0 Kudos

It is not permitted to update a PRIMARY KEY value in an UltraLite database. If you have a application requirement to update its value, you will need to DELETE the existing row and INSERT a new row. This restriction is needed because it creates complexity when involved in a synchronization.

Former Member
0 Kudos

Hi Chris,

Thank you very much for your solution.

I changed my update query to update non-primary key and it is working fine.

Thanks and Regards

Shashi

Answers (0)