JSONStore troubleshooting
Information required
Operating system and version For example, Windows XP SP3 Virtual Machine or Mac OSX 10.8.3. Eclipse version For example, Eclipse Indigo 3.7 Java EE. JDK version For example, Java SE Runtime Environment (build 1.7). IBM MobileFirst Platform Foundation version For example, IBM Worklight V5.0.6 Developer Edition. iOS version For example, iOS Simulator 6.1 or iPhone 4S iOS 6.0. Android version For example, Android Emulator 4.1.1 or Samsung Galaxy Android 4.0 API Level 14. Windows version For example, Windows 8 or Windows Phone 8.1. adb version For example, Android Debug Bridge version 1.0.31. Logs Such as Xcode output on iOS or logcat output on Android.
Isolate the issue
- Reset the emulator (Android) or simulator (iOS) and call the destroy API to start with a clean system.
- Ensure that you are running on a supported production environment.
- Android >= 2.3 ARM/x86 emulator or device
- iOS >= 6.0 simulator or device
- Windows Phone 8.0 ARM/x86 emulator or device
- Windows 8.0-8.1 ARM/x86/x64 simulator or device
- Try to turn off encryption by not passing a password to the init or open APIs.
- Look at the SQLite database file generated by JSONStore. Encryption must be turned off.
- Android emulator:
$ adb shell
$ cd /data/data/com.<app-name>/databases/wljsonstore
$ sqlite3 jsonstore.sqlite
- iOS simulator:
$ cd ~/Library/Application Support/iPhone Simulator/7.1/Applications/<id>/Documents/wljsonstore
$ sqlite3 jsonstore.sqlite
- Windows Phone 8:
$ cd C:\Data\Users\DefApps\AppData\<id>\Local\wljsonstore
$ sqlite3 jsonstore.sqlite
- Windows 8 simulator
$ cd C:\Users\<username>\AppData\Local\Packages\<id>\LocalState\wljsonstore
$ sqlite3 jsonstore.sqlite
JavaScript only implementation that runs on a web browser (Firefox, Chrome, Safari, Internet Explorer) does not use an SQLite database. The file is stores in HTML5 LocalStorage.
- Look at the searchFields with .schema and select data with SELECT * FROM <collection-name>;.
To exit sqlite3, type .exit. If we pass a user name to the init method, the file is called <username>.sqlite.
If we do not pass a user name, the file is called jsonstore.sqlite by default.
- (Android only) Enable verbose JSONStore.
adb shell setprop log.tag.jsonstore-core VERBOSE
adb shell getprop log.tag.jsonstore-core
- Use the debugger.
Common issues
- The only way to store binary data in JSONStore is to first encode it in base64.
Store file names or paths instead of the actual files in JSONStore.
- Access JSONStore data from native code is possible only in IBM MobileFirst Platform Foundation v6.2.0.
- There is no limit on how much data we can store inside JSONStore, beyond limits that are imposed by the mobile operating system.
- JSONStore provides persistent data storage. It is not only stored in memory.
- The init API fails when the collection name starts with a digit or symbol. IBM Worklight V5.0.6.1 and later returns an appropriate error:
4 BAD_PARAMETER_EXPECTED_ALPHANUMERIC_STRING
- There is a difference between a number and an integer in search fields.
Numeric values like 1 and 2 are stored as 1.0 and 2.0 when the type is number. They are stored as 1 and 2 when the type is integer.
- If an application is forced to stop or crashes, it always fails with error code -1 when the application is started again and the init or open API is called.
If this problem happens, call the closeAll API first.
- The JavaScript implementation of JSONStore expects code to be called serially. Wait for an operation to finish before you call the next one.
- Transactions are not supported in Android 2.3.x for hybrid applications.
Parent topic: JSONStore troubleshooting