Comments (18)
@blattmann thanks for your solution, save me from despair. Greets
from cordova-plugin-dbcopy.
SOLVED!
The problem was that I was copying to the wrong directory and on top tried to open the db from another directory!
And this happened because I mixed up a configuration inside of my service.
So just to keep it in case somebody might have the same issue:
The config from https://github.com/litehelpers/Cordova-sqlite-storage is a bit different as the config of cordova-plugin-dbcopy
:
Cordova-sqlite-storage:
default: Library/LocalDatabase subdirectory - NOT visible to iTunes and NOT backed up by iCloud
Library: Library subdirectory - backed up by iCloud, NOT visible to iTunes
Documents: Documents subdirectory - visible to iTunes and backed up by iCloud
cordova-plugin-dbcopy:
location = 0, will copy the db to default SQLite Database Directory
location = 1, will copy the database to /Library folder
location = 2, will copy the database to /Library/LocalDatabase folder (Disable iCloud Backup)
If you use /Library/LocalDatabase
the config is then default
for Cordova-sqlite-storage
and 2
for cordova-plugin-dbcopy
@ykarthikreddy18 : Thanks again for your support! Your questions and suggestions led me to the right solution!
from cordova-plugin-dbcopy.
@blattmann cheers.. At last u made it . All the best for your project
from cordova-plugin-dbcopy.
@blattmann
Hi,
Its been a long time that i solved it. I dont remember exactly what i did.
I got that problem in android but not in IOS.
check the db name and the data inside with sqlite browser.
from cordova-plugin-dbcopy.
Thanks for your quick reply. I had a look on the data (I used the simulator) and the data is fine, but I still cannot access it. I created a test script that creates a new table and I used the same database name as the database itself gets opened, BUT instead of writing the data in the existing table (I use CREATE TABLE IF NOT EXISTS...
) my script created a complete new database with the same database name and added the table and the data to this NEW database.
This new database is stored in:
/Users/123/Library/Developer/CoreSimulator/Devices/9E1ABD8D-A6E1-4F18-B5FA-CD6BA20A54D4/data/Containers/Data/Application/CBA91272-6A4A-413F-A884-A13AFBA86DB8/Library/LocalDatabase
and the copied database that I want to use is stored here:
/Users/123/Library/Developer/CoreSimulator/Devices/9E1ABD8D-A6E1-4F18-B5FA-CD6BA20A54D4/data/Containers/Data/Application/CBA91272-6A4A-413F-A884-A13AFBA86DB8/Documents
I replaced the new created database with the one I want to use but I still get this error:
Default Error Handler -> Error processing SQL: undefined: undefined 2016-04-20 10:20:08.551 MyProject[25079:18867159] Default Error Handler -> Error processing SQL: 5: a statement error callback did not return false: no such table: app_offers
But this table exists.
@an-rahulpandey
Hi Rahul, maybe you have an idea why this happens?
from cordova-plugin-dbcopy.
Is your issue solved?
from cordova-plugin-dbcopy.
yes rahul, solved... :)
from cordova-plugin-dbcopy.
How did you solve it?
I have the same issue. I am stuck since about 2 days now with the database bug on iOS.
Android works fine, but the db in iOS is empty.
from cordova-plugin-dbcopy.
@blattmann , i just worked with the copied database but i didnt made any changes to it.. rahul may help u in this case..
Just try to get the data from select query and check.maybe using create statements will create new db.. While copying , Try to copy the db in to the place where new db is creating.
from cordova-plugin-dbcopy.
I copied the db now with the dbcopy-plugin successfully to the right place in /Users/123/Library/Developer/CoreSimulator/Devices/9E1ABD8D-A6E1-4F18-B5FA-CD6BA20A54D4/data/Containers/Data/Application/CF155C36-B842-4419-B0C2-079839CE4F99/Library/LocalDatabase/
But now the database is empty again -> it has zero bytes.
I replaced the copied database with the one I want to use but I still cannot access it.
After I reopen the app I have access to my database and all works fine but this is not the solution as the copied database is still empty and even after that it should be instantly available.
from cordova-plugin-dbcopy.
is your db name is same .. name which is in www folder and the name inside the code while u r copying?
from cordova-plugin-dbcopy.
Yes. All is the same.
As I used the "wrong" location for the database it was copied including all tables, etc.
After I changed it to the new path (seems also to be a new requirement of iOS, if I understood it right) the database exists but maybe the script just copies / creates the database name because of the zero bytes
issue?
from cordova-plugin-dbcopy.
if the database which u r creating is already exists means it wont copy I think. if you want to copy , u should remove the old database.
window.plugins.sqlDB.copy("wikwio_idao.db",copysuccess,errorinc);
This is the code i used while copying.. Check you database with the sqlite browser
from cordova-plugin-dbcopy.
first of all: thanks that you are trying to get me out of that pit!
yes, i did check the database with the sqlite browser and it is empty: no tables.
i did reset my content and settings in the simulator each time before i started to test my app just to make sure the old database is removed and the "new" database is copied to the app.
from cordova-plugin-dbcopy.
you dont open the db..Just copy it and check whether it is copied or not. Try it on real device once.. It should work on simulator also but try it on real device. Check the db which is in www folder whether it has data or not. By this time you may have done all the above, but from here all i can say that only. post your question in Stack overflow you may get any help . Sorry @blattmann
from cordova-plugin-dbcopy.
Thanks @ykarthikreddy18 !!!
The db is still empty.
I checked it now again with the simulator. Here my logs.
(To make it easier for reading I replaced the path with the variable physicalPath
which is /Users/<user>/Library/Developer/CoreSimulator/Devices/94D5E8B1-75F1-4DD3-9BAF-0D9672A2B59B/data/Containers/Data/Application/1C431A7A-40D0-484E-9201-5AE50C58E026
)
LOGS:
'dbcopy: rcsappmobile.db
[sqlDB] Dbname = rcsappmobile.db
[sqlDB] location = 0
[sqlDB] documentsDirectory = physicalPath/Documents
[sqlDB] libraryDirectory = physicalPath/Library
[sqlDB] Source: /Users/sblatt/Library/Developer/CoreSimulator/Devices/94D5E8B1-75F1-4DD3-9BAF-0D9672A2B59B/data/Containers/Bundle/Application/E4F75711-6B67-49E5-A592-62DAB8C016B1/Ibiza 2016.app/www/rcsappmobile.db
[sqlDB] Destinatiion: physicalPath/Documents/rcsappmobile.db
Firstrun: Open database rcsappmobile.db
OPEN database: rcsappmobile.db
Initializing SQLitePlugin
Detected docs path: physicalPath/Documents
Detected Library path: physicalPath/Library
no cloud sync at path: physicalPath/Library/LocalDatabase
open full db path: physicalPath/Library/LocalDatabase/rcsappmobile.db'
I guess the database is first copied here [sqlDB] Destinatiion: physicalPath/Documents/rcsappmobile.db
and then copied to the final destination path physicalPath/Library/LocalDatabase/rcsappmobile.db'
. Maybe this is the part that creates my problem.
from cordova-plugin-dbcopy.
Are you opening the db before copying it?
from cordova-plugin-dbcopy.
no. i copy it and after that it is opened.
but maybe it is still opening too early?
if I check my logs I see that OPEN database
is printed before this information open full db path
.
I will disable the db opening for the moment and test it again!
from cordova-plugin-dbcopy.
Related Issues (20)
- copyDbFromStorage: DB Not Present in www folder HOT 2
- Copy from a different folder HOT 3
- Issue with Android copyDbFromStorage HOT 3
- Issue when building Android for ionic HOT 2
- copyDbFromStorage seems to fail for Android 9 HOT 4
- I can't insert or update after copied HOT 1
- Build error in v 2.1.0 HOT 4
- Phonegap build failed with latest version (2.1.1) HOT 8
- copying on a usb storage HOT 1
- copyDbFromStorage copy Db to wrong path in Android 9 HOT 4
- customize output file name HOT 1
- What's error code: 400? HOT 2
- Issue on Android 9 *AFTER* succesfull copy on device HOT 1
- Playstore shows crashed Apps
- Ionic 4 problem copy database.db HOT 3
- Error during installation of plugin HOT 1
- error during plugin installation
- copy to device storage
- showing database already exists HOT 1
- Does sqliteDbCopy run on Capacitor? error:400 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-dbcopy.