SYNOPSIS (OPTIONAL)

int db_connect( string database)
int db_connect( string database, string user)
int db_connect( string database, string user, string password)

DESCRIPTION

Connect to the database database on the local mySQL-server. The return-value is the handle for this connection. Automatic reconnects are enabled for this connection; see :concept:`mysql` for implications. If the database does not exist or the server is not started, a runtime-error is raised.

If specified, the connection is made for user with password.

The function is available only if the driver is compiled with mySQL support. In that case, __MYSQL__ is defined.

The efun triggers a privilege violation (“mysql”, “db_connect”).

HISTORY

  • introduced (3.2.9)
  • changed (3.2.11) – adds the privilege violation.