You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Nolan Lawson (JIRA)" <ji...@apache.org> on 2013/03/08 19:16:12 UTC
[jira] [Created] (CB-2639) SQLite error: 23 "not authorized" on
Android
Nolan Lawson created CB-2639:
--------------------------------
Summary: SQLite error: 23 "not authorized" on Android
Key: CB-2639
URL: https://issues.apache.org/jira/browse/CB-2639
Project: Apache Cordova
Issue Type: Bug
Components: Android
Affects Versions: 2.2.0
Environment: Several Android devices, apparently pre-4.1. See details below.
Reporter: Nolan Lawson
Assignee: Joe Bowser
(Moved from a comment I mistakenly added to CB-592.)
I am unable to insert/update to the SQLite database using the standard {{window.openDatabase()}} approach described in the [Storage docs|http://docs.phonegap.com/en/1.2.0/phonegap_storage_storage.md.html]. The transaction fails with the error "23: not authorized".
I'm using PhoneGap Build and PhoneGap v.2.2.0.
All I do is create a database:
{code:JavaScript}
var db = window.openDatabase('myDatabase', '1.0', "My Database", 1000000);
{code}
Then I call a simple chain of two queries on it:
{code:JavaScript}
function query(tx) {
tx.executeSql('select 1 from sqlite_master');
}
function onError() {
....
}
function onSuccess() {
db.transaction(query2, onError2, onSuccess2);
}
function query2(tx) {
tx.executeSql('create table mytable(mycolumn text)');
}
function onError2() {
....
}
function onSuccess2() {
....
}
db.transaction(query, onError, onSuccess);
{code}
The table below shows the Android devices that I tested this on, and the failure I got in each.
||Device||Android||Working?||Result||Logcat|| SQLError object||
|Galaxy Nexus|4.1.1|{color:green}Yes{color}|Logs an error, but still works.| {{SQLiteLog E (23) not authorized}}||
|Nexus One|2.3.7|{color:red}No{color}|Calls the {{onError2}} message above.|{{Database I sqlite returned: error code = 23, msg = not authorized}}|{code:JavaScript} {"message":"not authorized","code":1} {code}|
|HTC Magic|2.1-update1|{color:red}No{color}|Calls the {{onError2}} message above.|None|{code:JavaScript} {"code":1,"message":"not authorized"} {code}|
|Galaxy Tab 8.9|4.0.4|{color:red}No{color}|Calls the {{onError2}} message above.|{{SqliteDatabaseCpp I sqlite returned: error code = 23, msg = not authorized, db=xxx}}|{code:JavaScript} {"code":5,"message":"not authorized"} {code}|
|Samsung GT-I9001|2.3.6|{color:red}No{color}|Calls the {{onError2}} message above.|None|{code:JavaScript} {"message":"not authorized","code":1} {code}|
I've also tested on an iPod Touch (5th generation) with no issues.
Based on the comments in CB-592, it seems like the problem is caused by Android's native Web SQL Database implementation. Apparently they've supported it going back to 2.1 ([link|http://caniuse.com/sql-storage]), and the [Cordova docs|http://docs.phonegap.com/en/1.2.0/phonegap_storage_storage.md.html] say they defer to the native interface if it's available, meaning that it has nothing to do with Cordova's implementation.
I'm really hoping there's a workaround for this, since otherwise I'm unable to use SQLite on Android using Cordova.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira