Adam
Adam

Reputation: 325

SQLite error 14 in ViewController

import GRDB

class MyView: UIViewController{
    override func viewDidLoad() {
    super.viewDidLoad()
        do{
            let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
        }catch let error{
        print(error)
    }
    }
}

error is print SQLite error 14

what is SQLite error 14?

first use GRDB and first Call SqlLite

Why raise Error?

Ios 11.0 Swift 4.0 Grdb 2.10.0

Build to Iphone8 Simulater

Upvotes: 2

Views: 352

Answers (2)

Tim
Tim

Reputation: 66

SQLite error code 14 means

Unable to open the database file.

You can get the description from there: https://sqlite.org/c3ref/c_abort.html

For your question, what exactly the path is? Are you hard coded the path? Don't hard code the path, use pattern like

let path = NSHomeDirectory() + "/Documents/database.sqlite"

to get your database's path to see if your issue can be solved.

Upvotes: 3

user10100968
user10100968

Reputation:

The best solution for error 14 is to change the settings in the directory where the database file is stored so that write access is provided to the database file. In order to do so, you can run the following commands in case the web server you are using runs as www-data. ;)

Upvotes: 1

Related Questions