InterBase

From RadPHP XE2 Documentation
Jump to: navigation, search

When working with InterBase databases and RadPHP, you can either work with common data-access components or with InterBase-specific components. The formers will give your application flexibility in case you change to a different database management system in the future, while the laters will improve the overall performance of your database access and let you take full advantage of InterBase features.

Contents

Usage

Data Explorer Setup

When you set up a connection to an InterBase database from the Data Explorer, you must fill Database Name property with the database server address and database file path, separated by a colon (:). For example: localhost:C:\Users\User\Desktop\database.gdb.

Database Setup

To use a Database component with InterBase, set it up with the information below:

  • DriverName: ibase.
  • DatabaseName: This should be filled with the database server address and database file path, separated by a colon (:). For example: localhost:C:\Users\User\Desktop\database.gdb.

Do not forget to fill also the rest of the basic information. You can leave the Host property empty, though.

Work From PHP

// Set Connection Data
$database = 'database';			// Database server address and database file path, separated by a colon (''':''').
$user = 'user';				// Username to access the database.
$password = 'password';			// Password for the user.
 
// Establish Connection
$connection = ibase_connect($database, $user, $password);
 
// Connection Test
if (!$connection)
    echo 'InterBase Database could not be reached';
else
    echo 'Succesfully connected to InterBase Database';
 
// Perform a Query
$result = ibase_query($connection, "SELECT * FROM table");
while ($row = ibase_fetch_object($result)) {
    echo $row->field."<br />";
}
ibase_free_result($result);
 
// Close Database
ibase_close($connection);

Deployment

When deploying a project that uses InterBase, do not forget to uncomment (remove the ; at the beginning) the following line in your php.ini file:

;extension=php_interbase.dll

See Also

Personal tools