Oracle 5.0 Reference Manual page 2195

Table of Contents

Advertisement

Return Values
Zero if the statement was successful. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
20.6.6.52.
mysql_real_connect()
MYSQL *mysql_real_connect(MYSQL *mysql, const char *host, const char
*user, const char *passwd, const char *db, unsigned int port, const char
*unix_socket, unsigned long client_flag)
Description
mysql_real_connect()
host.
mysql_real_connect()
functions that require a valid
The parameters are specified as follows:
• For the first parameter, specify the address of an existing
mysql_real_connect(), call
change a lot of connect options with the
"mysql_options()".
• The value of
"localhost", a connection to the local host is assumed. For Windows, the client connects
using a shared-memory connection, if the server has shared-memory connections enabled.
Otherwise, TCP/IP is used. For Unix, the client connects using a Unix socket file. For local
connections, you can also influence the type of connection to use with the
or
MYSQL_OPT_NAMED_PIPE
supported by the server. For a
pipe, if the server has named-pipe connections enabled. If named-pipe connections are not enabled,
an error occurs.
• The
user
the current user is assumed. Under Unix, this is the current login name. Under Windows ODBC, the
current user name must be specified explicitly. See the Connector/ODBC section of
Connectors and
• The
passwd
table for the user that have a blank (empty) password field are checked for a match. This enables the
database administrator to set up the MySQL privilege system in such a way that users get different
privileges depending on whether they have specified a password.
C API Function Descriptions
[2942]
[2942]
[2942]
[2941]
attempts to establish a connection to a MySQL database engine running on
must complete successfully before you can execute any other API
MYSQL
mysql_init()
may be either a host name or an IP address. If
host
options to mysql_options(). The type of connection must be
host
parameter contains the user's MySQL login ID. If
APIs.
parameter contains the password for user. If
connection handle structure.
to initialize the
mysql_options()
value of
on Windows, the client connects using a named
"."
2175
structure. Before calling
MYSQL
structure. You can
MYSQL
call. See
Section 20.6.6.49,
is
host
NULL
MYSQL_OPT_PROTOCOL
is
or the empty string "",
user
NULL
is NULL, only entries in the
passwd
or the string
Chapter 20,
user

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents