UsePostgreSQLDatabase()

Syntax

UsePostgreSQLDatabase()
Description
Initialize the PostgreSQL database environment for future use.

Parameters

None.

Return value

None.

Remarks

PostgreSQL is a powerful, server based database manager which support very large database and high concurrency. It is free to use in commercial projects, unlike MySQL which requires a licence to use it in a non-GPL program. There is no additional driver to install, all is ready to connect a PostgreSQL server. For more information about PostgreSQL: http://www.postgresql.org.

A PostgreSQL database has to be connected using OpenDatabase() before using any other database functions. PostgresSQL specific parameters can be passed in the 'DatabaseName$' parameter of OpenDatabase():
  - host: Name of host to connect to.
  - hostaddr: Numeric IP address of host to connect to.
  - port: Port number to connect to at the server host.
  - dbname: The database name. Defaults to be the same as the user name. 
  - connect_timeout: Maximum wait for connection, in seconds (write as a decimal integer string). 
                     Zero or not specified means wait indefinitely. 
                     It is not recommended to use a timeout of less than 2 seconds.

Example

  UsePostgreSQLDatabase()

  ; You should have a server running on localhost
  ;
  If OpenDatabase(0, "host=localhost port=5432", "postgres", "postgres")
    Debug "Connected to PostgreSQL"
  Else
    Debug "Connection failed: "+DatabaseError()
  EndIf

See Also

OpenDatabase(), UseSQLiteDatabase(), UseODBCDatabase()

Supported OS

All

<- UseODBCDatabase() - Database Index - UseSQLiteDatabase() ->