{ "id": "172490", "key": "TIMOB-26485", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2018-10-25T21:10:37.000+0000", "created": "2018-10-25T07:21:46.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-10-26T19:59:29.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Trying to install a local database(dumped form SQlite Manager) on Android using *Titanium.Database.Install()* and it provides error. \r\n\r\n*Testing Environment:*\r\n\r\nAppcelerator Command-Line Interface, version 7.0.6,Operating System Mac OS X 10.13.6, Node.js Version 8.9.1\r\nSDK Version 7.4.1.GA,Device: Huawei GR3 (Android 7)\r\n\r\n*Test Steps:*\r\n\r\n1. Create an alloy app\r\n2.Paste the sample code to app directory and sample database to app->lib directory(sample db file is attached)\r\n2. Run the project , click the label and check console\r\n\r\n*Test Code:*\r\n*index.js*\r\n{code}\r\nfunction doClick(e) {\r\n\t\r\n var db = Ti.Database.install('/lib/db', 'db');\r\n var db = Ti.Database.open('db');\r\n var importName='def';\r\n var imporCaptured='567';\r\n db.execute('INSERT INTO info (name,captured) VALUES (?,?)', importName, imporCaptured);\r\n\r\n var cityWeatherRS = db.execute('SELECT id,name,captured FROM info');\r\n while (cityWeatherRS.isValidRow()) {\r\n var cityId = cityWeatherRS.fieldByName('id');\r\n var cityName = cityWeatherRS.fieldByName('name');\r\n var citycaptured = cityWeatherRS.fieldByName('captured');\r\n Ti.API.info(cityId + ' ' + cityName + ' ' + citycaptured);\r\n \r\n \r\n cityWeatherRS.next();\r\n}\r\n\r\ndb.close();\r\n\r\n}\r\n\r\n$.index.open();\r\n\r\n{code}\r\n*index.xml*\r\n{code}\r\n\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n\r\n{code}\r\n\r\n*Test output:*\r\n{code}\r\n[ERROR] : TiDB: (main) [7582,7583] Error executing sql: no such table: info (Sqlite code 1): , while compiling: INSERT INTO info (name,captured) VALUES (?,?), (OS error - 2:No such file or directory)\r\n[ERROR] : TiDB: android.database.sqlite.SQLiteException: no such table: info (Sqlite code 1): , while compiling: INSERT INTO info (name,captured) VALUES (?,?), (OS error - 2:No such file or directory)\r\n[ERROR] : TiDB: \tat android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)\r\n[ERROR] : TiDB: \tat android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:910)\r\n[ERROR] : TiDB: \tat android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:521)\r\n[ERROR] : TiDB: \tat android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:603)\r\n[ERROR] : TiDB: \tat android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:63)\r\n[ERROR] : TiDB: \tat android.database.sqlite.SQLiteStatement.(SQLiteStatement.java:31)\r\n[ERROR] : TiDB: \tat android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1965)\r\n[ERROR] : TiDB: \tat android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1941)\r\n[ERROR] : TiDB: \tat ti.modules.titanium.database.TiDatabaseProxy.execute(TiDatabaseProxy.java:142)\r\n[ERROR] : TiDB: \tat org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)\r\n[ERROR] : TiDB: \tat org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)\r\n[ERROR] : TiDB: \tat org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:969)\r\n[ERROR] : TiDB: \tat org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1194)\r\n[ERROR] : TiDB: \tat org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:394)\r\n[ERROR] : TiDB: \tat android.os.Handler.dispatchMessage(Handler.java:101)\r\n[ERROR] : TiDB: \tat android.os.Looper.loop(Looper.java:156)\r\n[ERROR] : TiDB: \tat android.app.ActivityThread.main(ActivityThread.java:6523)\r\n[ERROR] : TiDB: \tat java.lang.reflect.Method.invoke(Native Method)\r\n[ERROR] : TiDB: \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)\r\n[ERROR] : TiDB: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)\r\n[ERROR] : TiExceptionHandler: (main) [4,7587] /alloy/controllers/index.js:59\r\n[ERROR] : TiExceptionHandler: \t\tdb.execute('INSERT INTO info (name,captured) VALUES (?,?)', importName, imporCaptured);\r\n[ERROR] : TiExceptionHandler: ^\r\n[ERROR] : TiExceptionHandler: Error: no such table: info (Sqlite code 1): , while compiling: INSERT INTO info (name,captured) VALUES (?,?), (OS error - 2:No such file or directory)\r\n[ERROR] : TiExceptionHandler: at Label.doClick (/alloy/controllers/index.js:59:6)\r\n[ERROR] : TiExceptionHandler: at Label.value (ti:/events.js:49:21)\r\n[ERROR] : TiExceptionHandler: at Label.value (ti:/events.js:101:19)\r\n[ERROR] : TiExceptionHandler:\r\n[ERROR] : TiExceptionHandler: android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)\r\n[ERROR] : TiExceptionHandler: android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:910)\r\n[ERROR] : TiExceptionHandler: android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:521)\r\n[ERROR] : TiExceptionHandler: android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:603)\r\n[ERROR] : TiExceptionHandler: android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:63)\r\n[ERROR] : TiExceptionHandler: android.database.sqlite.SQLiteStatement.(SQLiteStatement.java:31)\r\n[ERROR] : TiExceptionHandler: android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1965)\r\n[ERROR] : TiExceptionHandler: android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1941)\r\n[ERROR] : TiExceptionHandler: ti.modules.titanium.database.TiDatabaseProxy.execute(TiDatabaseProxy.java:142)\r\n[ERROR] : TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)\r\n[INFO] : HwPointEventFilter: do not support AFT because of no config\r\n[ERROR] : V8Exception: Exception occurred at /alloy/controllers/index\r\n{code}", "attachment": [ { "id": "65773", "filename": "db.sqlite", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-10-25T07:21:00.000+0000", "size": 12288, "mimeType": "application/octet-stream" } ], "flagged": false, "summary": "Android: Local database provides error in Alloy", "creator": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Appcelerator Command-Line Interface, version 7.0.6,\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.13.6\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\nNode.js\r\n Node.js Version = 8.9.1\r\n npm Version = 5.5.1\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = 7.4.1.GA\r\n SDK Path = /Users/sharifabudarda/Library/Application Support/Titanium/mobilesdk/osx/7.4.1.GA\r\n Target Platform = android", "closedSprints": [ { "id": 1088, "state": "closed", "name": "2018 Sprint 22", "startDate": "2018-10-21T23:20:52.653Z", "endDate": "2018-11-04T23:20:00.000Z", "completeDate": "2018-11-04T23:29:59.423Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "442960", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The file path is invalid. They need to specify the database like so:\r\n{code:js}\r\n// you should only install the database once\r\n// this copies the database to internal storage\r\n// overwriting any previous internal database of the same name\r\nvar db = Ti.Database.install('lib/db.sqlite', 'db'); // NOTE: I fixed the path\r\n\r\n// once the database is installed you should only use open()\r\n// this will open and use the internal database\r\nvar db = Ti.Database.open('db');\r\n{code}\r\n\r\nThey need to have a condition to only use {{open()}} after installing the database the first time the app is used.", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-25T21:00:22.000+0000", "updated": "2018-10-25T21:01:21.000+0000" }, { "id": "442989", "author": { "name": "josh.magalich@crompco.com", "key": "josh.magalich@crompco.com", "displayName": "Josh Magalich", "active": true, "timeZone": "America/New_York" }, "body": "I have been having this same issue for days now. I have tried all kinds of things to get this to work. I just used the the above database and sample code and still get the error stating the table does not exist. I have read so many postings on other sites that have the same issue. This is such a simple thing to do. I have used this same approach years ago in Appcelerator on a classic app and it worked fine. I'm about ready to give up on Appcelerator even though I just purchased a Pro plan a couple weeks ago.", "updateAuthor": { "name": "josh.magalich@crompco.com", "key": "josh.magalich@crompco.com", "displayName": "Josh Magalich", "active": true, "timeZone": "America/New_York" }, "created": "2018-10-26T17:45:01.000+0000", "updated": "2018-10-26T17:45:01.000+0000" }, { "id": "442990", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~josh.magalich@crompco.com] Could you provide a snippet of your database code?", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-26T17:53:39.000+0000", "updated": "2018-10-26T17:53:39.000+0000" }, { "id": "442991", "author": { "name": "josh.magalich@crompco.com", "key": "josh.magalich@crompco.com", "displayName": "Josh Magalich", "active": true, "timeZone": "America/New_York" }, "body": "Below is the snippet of code I am using to install my database for the first time and insert a test record in the \"user\" table. I have even tried using your database file with the code and got the error. I have also tried to use a hypnosis.sqlite file and got the same results. Thank you.\r\n\r\n{code:javascript}\r\nvar db = Ti.Database.install('lib/hypnosis.db', 'hypnosis');\r\nvar db = Ti.Database.open('hypnosis');\r\ndb.execute('INSERT INTO user (user_name, password) VALUES (?,?)', \"a\", \"a\");\r\n{code}\r\n\r\nBelow is the beginning part of the error I get that is the same as the original error of this ticket. \r\n[ERROR] : SQLiteLog: (1) no such table: user\r\n[ERROR] : TiDB: (main) [6266,6266] Error executing sql: no such table: user (code 1): , while compiling: INSERT INTO user (user_name, password) VALUES (?,?)\r\n[ERROR] : TiDB: #################################################################\r\n[ERROR] : TiDB: Error Code : 1 (SQLITE_ERROR)\r\n[ERROR] : TiDB: Caused By : SQL(query) error or missing database.\r\n[ERROR] : TiDB: \t(no such table: user (code 1): , while compiling: INSERT INTO user (user_name, password) VALUES (?,?))", "updateAuthor": { "name": "josh.magalich@crompco.com", "key": "josh.magalich@crompco.com", "displayName": "Josh Magalich", "active": true, "timeZone": "America/New_York" }, "created": "2018-10-26T18:16:52.000+0000", "updated": "2018-10-26T18:20:46.000+0000" }, { "id": "442992", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Make sure your {{hypnosis.db}} file is placed under {{Resources/lib/hypnosis.db}} in your project.\r\n\r\nAlso, as mentioned in my comment above. You should not call:\r\n{code:js}\r\nvar db = Ti.Database.open('hypnosis');\r\n{code}\r\nAfter {{install}}, you must only use one or the other. {{install}} should only be used the first time your app is launched. Every other time should use {{open}} as the database has already been installed. This is unless you want your internal database to be overwritten every time, which you would always use {{install}}.\r\n\r\nMake sure your database is the correct format to be used with SQLite.\r\n\r\nIf possible, you could attach your {{hypnosis.db}} (or a similar database without sensitive information) that I could test.", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-26T18:21:49.000+0000", "updated": "2018-10-26T18:27:05.000+0000" }, { "id": "442996", "author": { "name": "josh.magalich@crompco.com", "key": "josh.magalich@crompco.com", "displayName": "Josh Magalich", "active": true, "timeZone": "America/New_York" }, "body": "I have tried to attach my database file to these comments but cannot find anywhere to do it. When I click on the attachment icon in the tool bar I just see your db.sqlite file and cannot upload my own. I did send you an email with my db file attached but not sure if it went through or not. Thanks.", "updateAuthor": { "name": "josh.magalich@crompco.com", "key": "josh.magalich@crompco.com", "displayName": "Josh Magalich", "active": true, "timeZone": "America/New_York" }, "created": "2018-10-26T19:59:29.000+0000", "updated": "2018-10-26T19:59:29.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }