2
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

Adam
  • 325
  • 1
  • 4
  • 20

2 Answers2

3

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.

Tim
  • 66
  • 2
1

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. ;)