title: Why do I get Unable to Open Database file?
body: <p>I am a beginner in iOS development and I want to develop a database in my application. However, When I try to create the database it says <strong>unable to open database file</strong>.</p>
  
  <p><a href="https://i.stack.imgur.com/AHFBN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AHFBN.png" alt="enter image description here"></a></p>
  
  <p>For clarification (<a href="https://github.com/stephencelis/SQLite.swift/blob/master/Documentation/Index.md" rel="nofollow noreferrer">https://github.com/stephencelis/SQLite.swift/blob/master/Documentation/Index.md</a>)</p>
  
  <p><a href="https://i.stack.imgur.com/1cUc7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1cUc7.png" alt="enter image description here"></a></p>
  
  <p>My code for the db development is as follow</p>
  
  <pre><code>static func DB(){
  
          do {
              let db = try Connection("db.sqlite3")
              let users = Table("users")
              let id = Expression&lt;Int64&gt;("id")
              let name = Expression&lt;String?&gt;("name")
              let email = Expression&lt;String&gt;("email")
  
              try db.run(users.create { t in
                  t.column(id, primaryKey: true)
                  t.column(name)
                  t.column(email, unique: true)
                  })
  
          } catch {
              print("Dim background error")
          }
  }
  </code></pre>
  
  <p>I trigger this method from app delegate file</p>
  
  <pre><code>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool {
          // Override point for customization after application launch.
  
          AppCommon.DB()
  
          return true
      }
  </code></pre>
  
  <p>How to fix this issue? Please help me out, I really need your help..!</p>