on 05-14-2015 9:11 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.