Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Ionic 4, Unable to create sqlite db in custom location #237

Open
Rakshithkhatokar opened this issue Oct 3, 2018 · 1 comment
Open

Ionic 4, Unable to create sqlite db in custom location #237

Rakshithkhatokar opened this issue Oct 3, 2018 · 1 comment

Comments

@Rakshithkhatokar
Copy link

Hi

In my ionic app, i am logging the data inside every functions/implementation, Now the issue is , to store this log is i am using latest version of native sqlite plugin, it is working fine for default location, if i change the location path, by giving internal sd card i am gettin error as
Valid IOS data base location could not be determined in open database call

code snippet
my path, where db is to be created
/sdcard/ReportLogs/
sqlite.create({name: dbName, location: "/sdcard/ReportLogs/"}).then((db: SQLiteObject) => {
db.executeSql(query, [])
.then(res => {
resolve(res);
console.log('Executed SQL')
})
.catch(e =>{
reject(e);
console.log(e)}
);

  });
@devShahNimesh
Copy link

Following is my code snippet.

this.file.resolveNativePath('file://android/data/com.android.weightapp/file/db/').then(path=>{
this.sqlite
.create({
name: "weightdb.db",
location: path
})
.then((db: SQLiteObject) => {
"CREATE TABLE IF NOT EXISTS test(rowid INTEGER PRIMARY KEY, m_id INTEGER,m_code TEXT, m_name TEXT, m_no TEXT)"
}).then(res=>{
this.helper.toastMessage("First"+JSON.stringify(path))
alert("Sucess"+JSON.stringify(res))
}).catch(error=>{
alert("First Error"+ error)
})
})

I am having the same error.
Valid IOS data base location could not be determined in open database call.

Can anyone have the solution. Any help would be appreciated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants