Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on May 14, 2015 at 02:55 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.