Connect to the database server with the provided connection string conninfo
.
character(:), allocatable :: conninfo
type(c_ptr) :: conn
conninfo = "host=localhost user=postgres dbname=postgres password=foobar"
conn = PQcoonectdb(conninfo)
! Error handling
if (PQstatus(conn) /= CONNECTION_OK) then
print *, PQerrorMessage(conn)
end if
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | conninfo |
PostgreSQL connection string |