'Connect to Postgres from Swift
In a Swift app, how does one connect to a Postgres database server?
- In Java, we use JDBC with an compliant driver to connect to a Postgres server, communicate SQL, and get a result set.
- In a Win32 app, we use ODBC with a compliant driver to do the same.
How to do the equivalent from Swift?
Solution 1:[1]
You may use Postgres C API libpq. However, at least a thin layer of Swift will be needed to make it object-oriented and ARC compliant. An example implementation of that layer may be like so: stepanhruda/PostgreSQL-Swift.
Solution 2:[2]
You can try to use PostgresClientKit
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Bu?ra Ekuklu |
Solution 2 | Ilya Biltuev |