Connect to the database server with connection infomation provided as each argument
type(c_ptr) :: conn
conn = PQsetdbLogin("localhost", "5432", "", "", "postgres","postgres", "")
! Error handling
if (PQstatus(conn) /= CONNECTION_OK) then
print *, PQerrorMessage(conn)
end if
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | host |
Hostname |
||
character(len=*), | intent(in) | :: | port |
Port number |
||
character(len=*), | intent(in) | :: | options |
Options |
||
character(len=*), | intent(in) | :: | tty |
Empty string |
||
character(len=*), | intent(in) | :: | dbName |
The name of the database |
||
character(len=*), | intent(in) | :: | login |
The user name at this login |
||
character(len=*), | intent(in) | :: | pwd |
The password of the user |