Group Group Group Group Group Group Group Group Group

Unable to create a connection in SQLite with Swift course

Hi there!
I’m having problem on creating a connection on this course. I dont really know why it cannot create a connection. I have create the directory they have specified on the Get Start section but it still does not work.

Does anyone know what would be the problem here?

@patleo Do you still have issues with this?

@shogunkaramazov, @nikolasburk

I don’t know if the original poster still has problems, but I just started the course and I am having the same problem…

I typed this into terminal and it created the folder needed:
mkdir -p ~/Documents/Shared\ Playground\ Data/SQLiteTutorial

This exists now:
Macintosh HD⁩ ▸ ⁨Users⁩ ▸ ⁨jameshannon⁩ ▸ ⁨Documents⁩ ▸ ⁨Shared Playground Data⁩

I copied the code from the course to create a connection: I made a quick update to the print statement for debugging purposes…

func openDatabase() -> OpaquePointer? {
var db: OpaquePointer? = nil
if sqlite3_open(part1DbPath, &db) == SQLITE_OK {
print(“Successfully opened connection to database at (part1DbPath)”)
return db
} else {
print(“Unable to open database. in (part1DbPath)”)
PlaygroundPage.current.finishExecution()
}
}
let db = openDatabase()

There are no errors, but when I run it, I get this response:

Unable to open database. in /Users/jameshannon/Library/Developer/XCPGDevices/157933E6-DAE3-43FA-9DBD-1A2B2C5F7DF2/data/Containers/Data/Application/53868F80-633F-4E3C-A67B-EEFEF093B0CD/Documents/Shared Playground Data/SQLiteTutorial/Part1.sqlite

Could use some help figuring out what I’m doing wrong…

Thank you…