12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

<strong>C++</strong>Builder Database Architecture<br />

To avoid logg<strong>in</strong>g <strong>in</strong> each time the database is opened, set the KeepConnection property<br />

to true.<br />

If the Log<strong>in</strong>Prompt property is set to true, the user will be prompted for log<strong>in</strong> <strong>in</strong>formation<br />

when connect<strong>in</strong>g to the database server. You can override this us<strong>in</strong>g the OnLog<strong>in</strong> event<br />

(detailed <strong>in</strong> the follow<strong>in</strong>g section, “Tasks”).<br />

Set the TransIsolation property to specify the transaction isolation level (TIL) to establish on<br />

the database server. The TIL you select affects both your ability to see transactions orig<strong>in</strong>ated<br />

by other users and their ability to see transactions you <strong>in</strong>itiate.<br />

Tasks<br />

Your application must <strong>in</strong>clude a Database component to do any of the follow<strong>in</strong>g:<br />

■ Establish a permanent database connection<br />

■ Establish local, application-specific database aliases<br />

■ Change server log<strong>in</strong> parameters<br />

■ Manipulate server-based transaction-control mechanisms<br />

Establish<strong>in</strong>g Database Connections<br />

<strong>C++</strong>Builder applications connect to SQL servers us<strong>in</strong>g the SQL L<strong>in</strong>ks drivers for the <strong>Borland</strong><br />

Database Eng<strong>in</strong>e. These drivers provide access to the InterBase, Sybase, Oracle, and<br />

Microsoft DBMSs.<br />

Typically, you’ll use the Database Explorer or the BDE Configuration utility to construct<br />

database aliases through which your application will connect to these back-end servers. A<br />

BDE alias is no more than a named parameter list—a set of connection <strong>in</strong>formation that the<br />

BDE uses to connect you to your database. Once you’ve set up an alias, it appears <strong>in</strong> the<br />

DatabaseName property list of TDataset components such as TTable and TQuery. You can<br />

override the defaults provided by a BDE alias by edit<strong>in</strong>g TDatabase’s Params property. The<br />

sett<strong>in</strong>gs you make <strong>in</strong> Params override the parameters that are embedded <strong>in</strong> the alias def<strong>in</strong>ition.<br />

Reta<strong>in</strong><strong>in</strong>g Database Connections<br />

You set the KeepConnection property of a TDatabase component to true to cause database<br />

connections to be reta<strong>in</strong>ed even when no TDatasets are open. This is necessary if you want<br />

to avoid hav<strong>in</strong>g to log <strong>in</strong> the next time a connection is needed.<br />

439<br />

12

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

Saved successfully!

Ooh no, something went wrong!