09.01.2013 Views

RAD Studio for Microsoft .NET - Embarcadero Technologies

RAD Studio for Microsoft .NET - Embarcadero Technologies

RAD Studio for Microsoft .NET - Embarcadero Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1.1 Developing Database Applications with <strong>RAD</strong> <strong>Studio</strong> <strong>for</strong> <strong>Microsoft</strong> .<strong>NET</strong> Getting Started with InterBase Express<br />

TIBTransaction Provides discrete transaction control over a one or more<br />

database connections in a database application.<br />

TIBUpdateSQL Provides an object <strong>for</strong> updating read-only datasets when<br />

cached updates are enabled.<br />

TIBDataSet Executes InterBase SQL statements.<br />

TIBSQL Provides an object <strong>for</strong> executing an InterBase SQL<br />

statement with minimal overhead.<br />

TIBDatabaseInfo Returns in<strong>for</strong>mation about the attached database.<br />

TIBSQLMonitor Monitors dynamic SQL passed to the InterBase server.<br />

TIBExtract Fetches metadata from an InterBase server.<br />

TIBCustomDataSet The base class <strong>for</strong> all datasets that represent data fetched<br />

using InterBase Express.<br />

Though they are similar to BDE components in name, the IBX components are somewhat different. For each component with a<br />

BDE counterpart, the sections below give a discussion of these differences.<br />

There is no simple migration from BDE to IBX applications. Generally, you must replace BDE components with the comparable<br />

IBX components, and then recompile your applications. However, the speed you gain, along with the access you get to the<br />

powerful InterBase features make migration well worth your time.<br />

IBDatabase<br />

Use a TIBDatabase component to establish connections to databases, which can involve one or more concurrent transactions.<br />

Unlike BDE, IBX has a separate transaction component, which allows you to separate transactions and database connections.<br />

To set up a database connection:<br />

1. Drop an IBDatabase component onto a <strong>for</strong>m or data module.<br />

2. Fill out the DatabaseName property. For a local connection, this is the drive, path, and filename of the database file. Set the<br />

Connected property to true.<br />

3. Enter a valid username and password and click OK to establish the database connection.<br />

user_name=sysdba<br />

password=masterkey<br />

IBTransaction<br />

Warning: Tip: You can store the username and password in the IBDatabase component's Params<br />

property by setting the LoginPrompt property to false after logging in. For example, after logging in<br />

as the system administrator and setting the LoginPrompt property to false, you may see the<br />

following when editing the Params property:<br />

Unlike the Borland Database Engine, IBX controls transactions with a separate component, TIBTransaction. This powerful<br />

feature allows you to separate transactions and database connections, so you can take advantage of the InterBase two-phase<br />

commit functionality (transactions that span multiple connections) and multiple concurrent transactions using the same<br />

connection.<br />

Use an IBTransaction component to handle transaction contexts, which might involve one or more database connections. In<br />

most cases, a simple one database/one transaction model will do.<br />

To set up a transaction:<br />

1. Set up an IBDatabase connection as described above.<br />

33<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!