I am creating a hybrid app by telerik app builder in visual studio. I am not able to access sqlite db which is created externally. But I can access the db which is created at run time. I referred some sites, those solutions are not worked for me. The following code will create db and access it while run time
var app = {};
app.db = null;
app.openDb = function () {
var dbName = "Test.sqlite";
if (window.navigator.simulator === true) {
app.db = window.openDatabase(dbName, "1.0", "Test Database", 1073741824);
console.log("Database Created!");
}
else {
app.db = window.sqlitePlugin.openDatabase(dbName);
console.log("Database Accessed!");
}
}
I want to access the database which is present in the ~/data/Test.sqlite folder.
I Included the following scripts in my page
<script src="js/AosJS/common.js"></script>
<script src="js/vendor/jquery-2.1.0.min.js"></script>
<script src="js/angular.min.js"></script>
<script src="js/AosJS/index.js"></script>
<script src="js/ng-cordova.min.js"></script>
What I have tried:
I tried to place the db in www folder and try to access it by the following code
app.db = window.sqlitePlugin.openDatabase({name: "Test.db", createFromLocation: 1});
It will give the following error
Uncaught TypeError: Cannot read property 'openDatabase' of undefined