Coder Social home page Coder Social logo

Comments (6)

an-rahulpandey avatar an-rahulpandey commented on June 11, 2024

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.

khanSufiyan avatar khanSufiyan commented on June 11, 2024

I made a test db with DB Browser for SQLite and still got that same error

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on June 11, 2024

Can you post some code?

from cordova-plugin-dbcopy.

khanSufiyan avatar khanSufiyan commented on June 11, 2024

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.

an-rahulpandey avatar an-rahulpandey commented on June 11, 2024

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.

khanSufiyan avatar khanSufiyan commented on June 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.