警告 |
この関数は、 実験的なステータスにあります。これは、この関数の 動作、関数名、ここで書かれていること全てがPHPの将来のバージョンで予告 なく変更される可能性があることを意味します。注意を喚起するとともに自分 のリスクでこの関数を使用してください。 |
Creates a new connection to an IBM DB2 Universal Database, IBM Cloudscape, or Apache Derby database.
For a cataloged connection to a database, database represents the database alias in the DB2 client catalog.
For an uncataloged connection to a database, database represents a complete connection string in the following format: DRIVER={IBM DB2 ODBC DRIVER};DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;UID=username;PWD=password; where the parameters represent the following values:
The name of the database.
The hostname or IP address of the database server.
The TCP/IP port on which the database is listening for requests.
The username with which you are connecting to the database.
The password with which you are connecting to the database.
The username with which you are connecting to the database.
For uncataloged connections, you must pass a NULL value or empty string.
The password with which you are connecting to the database.
For uncataloged connections, you must pass a NULL value or empty string.
An associative array of connection options that affect the behavior of the connection, where valid array keys include:
Passing the DB2_AUTOCOMMIT_ON value turns autocommit on for this connection handle.
Passing the DB2_AUTOCOMMIT_OFF value turns autocommit off for this connection handle.
Returns a connection handle resource if the connection attempt is successful. If the connection attempt fails, db2_connect() returns FALSE.
例 2. Creating an uncataloged connection An uncataloged connection enables you to dynamically connect to a database.
上の例の出力は以下となります:
|
例 3. Creating a connection with autocommit off by default Passing an array of options to db2_connect() enables you to modify the default behavior of the connection handle.
上の例の出力は以下となります:
|