PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




ibase_connect

Name

ibase_connect — Open a database connection

Synopsis

resource ibase_connect(database[, username][, password][, charset][, buffers][, dialect][, role]);
string database: Path to the database file
string username (optional): Username
string password (optional): Password
string charset (optional): Name of character set the client is using
int buffers (optional): Number of cache buffers the database should allocate
int dialect (optional): Version number of InterBase's SQL dialect to use on the connection
string role (optional): Database access role to use

Returns

Connection handle, FALSE on error

Description

Opens a connection to an InterBase server or database.

Parameter database has to be a valid path to the database file on the host where it resides. If the server is local, just give the database path. If not, prefix if with "hostname:" (TCP/IP), "//hostname/" (NetBEUI) or "hostname@" (IPX/SPX) depending on the network protocol you use for connection. In case you give only the first parameter, you can also supply default values for username and password using PHP configuration directivesibase.default_userandibase.default_password, otherwise both default to an empty string.

Parameter charset specifies the character set your script is using, in case data transferred needs to be translated to another one used by the database. Most often you don't even have to think about it. Defaults to an empty string, i.e., no conversion will happen. For the list of all possible values and what this actually means, please refer to InterBase documentation, Language Reference, chapter "Character Sets and Collation Orders".

buffers specifies the number of database buffers the server should allocate for its data cache. Has no effect whatsoever unless it's higher than the databases default. If your database is big, you have lots of memory available. and your queries run too slowly, you can try increasing this value to gain more performance. If omitted or 0, the server uses the database's default.

dialect selects the version of InterBase's SQL dialect to use on the connection, and it defaults to the highest one supported by client libraries.

role is the access role to use if they have been set up with your database. Consult your database administrator if he/she exists, otherwise there most probably aren't any roles to choose from or you did the setup yourself and know perfectly well which one to choose.

If you call ibase_connect() with exactly the same parameters when the previous connection is still open, you won't get a new connection handle but instead a handle to the already open connection.

The database connection is closed automatically when your script ends, unless you explicitly close it earlier with ibase_close() .

Note

Available in PHP 3 since 3.0.6, PHP 4

Note

Parameters buffers , dialect and role were added in PHP 4 RC2.

Note

Some users have reported that on Windows NT, they have had to use paths like "localhost:c:\db\test.gdb" or "\\localhost\c:\db\test.gdb".

Example

Example 538. Connect to database

$db = ibase_connect('localhost:/path/to/employee.gdb', 'SYSDBA', 'masterkey', '', 512, 3)
   or die('Couldn't connect to database!');



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.