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?
asked Mar 26, 2016 at 2:21
-
1You can call any C code in Swift.Sulthan– Sulthan2016年03月26日 11:45:53 +00:00Commented Mar 26, 2016 at 11:45
-
@Basil Bourque have u found any solution, if yes please share it with usnoor– noor2016年06月14日 15:48:43 +00:00Commented Jun 14, 2016 at 15:48
2 Answers 2
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.
answered Jul 14, 2016 at 14:45
You can try to use PostgresClientKit
answered Apr 16, 2022 at 11:00
Explore related questions
See similar questions with these tags.
default