Comments (6)
I think renaming the db from mysql to .db will not work.
That's why you are getting this -
message: "sqlite3_prepare_v2 failure: file is encrypted or is not a database"
Check these out for the utility -
http://www.sqlite.org/cvstrac/wiki?p=ConverterTools
from cordova-plugin-dbcopy.
I made a test db with DB Browser for SQLite and still got that same error
from cordova-plugin-dbcopy.
Can you post some code?
from cordova-plugin-dbcopy.
DB COPY CODE
if (window.cordova) {
window.plugins.sqlDB.copy("CSIR_DB.db",0, function() {
console.log("done coping");
db = $cordovaSQLite.openDB({name: "CSIR_DB.db", location:'default'});
}, function(error) {
console.error("There was an error copying the database: " +JSON.stringify(error) );
db = $cordovaSQLite.openDB({name: "CSIR_DB.db", location: 'default'});
});
console.log("Android");
}else{
//db = $cordovaSQLite.openDB({name: "CSIR_DB .db", location: 0});
db = window.openDatabase("CSIR_DB.db", '1', 'CSIR_DB', 1024 * 1024 * 100); // browser
console.log("browser");
}
SELECT QUERY
var query = "select lab_id,lab_name,lab_abbr from lab_master";
$scope.lablist = new Array();
$cordovaSQLite.execute(db, query, []).then(function(res)
{
if(res.rows.length > 0)
{
console.log("in for", res.rows.item(i).lab_id,
res.rows.item(i).lab_name,
res.rows.item(i).lab_abbr);
for(var i = 0; i < res.rows.length; i++)
{
var obj = {
lab_id: res.rows.item(i).lab_id,
lab_name: res.rows.item(i).lab_name,
lab_abbr:res.rows.item(i).lab_abbr
};
$scope.lablist.push(obj);
}
} else
{
console.log("No results found");
}
});
from cordova-plugin-dbcopy.
Are you getting this error -
message: "sqlite3_prepare_v2 failure: file is encrypted or is not a database"
Can you check the native error log in monitor (if using Android) or Xcode?
from cordova-plugin-dbcopy.
Hi Rahul
I reinstalled the plugin and and made a new db file with DB Browser for SQLite and it started to work!!!
I think there was an error with the db.
Thanks for the support man...
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.