Accessing Data Using the Advantage DBI Driver (for Perl)


Accessing data using the Advantage DBI Driver (for Perl) is very similar to that for PHP, since both drivers rely on the Advantage ODBC Driver, but there are important differences. Besides the language difference, there are four primary differences between the Advantage PHP Extension and the Advantage DBI Driver.

The first is associated with the connection string that the DBI driver will send to the ODBC API. This connection string always begins with the dbi:Advantage: string. Everything that follows this string is identical to the parameters listed in Table 16-1 that you use for both the Advantage ODBC Driver and the Advantage PHP Extension.

The following is an example of a connection string that makes a connection similar to that shown in the PHP examples:

use DBI; $dbh = DBI->connect( 'dbi:Advantage:DataDirectory=\\server\share' .   '\program files\extended systems\advantage\adsbook\' .   'DemoDictionary.add;ServerTypes=2;', 'adsuser', 'password' );

The second difference, which you may have already noticed if you examined the preceding example, is that the extended functions for the DBI driver are similar in name, but not identical, to those used by the PHP Extension. Specifically, while the number and type of parameters are the same, the functions do not use the “ads_” prefix. For example, in PHP you connect to ADS by calling the ads_connect function, but in Perl you call the connect method of the DBI object.

The third difference is that data access in Perl uses a different paradigm from PHP. This approach to data access should be familiar to any seasoned Perl developer.

And the fourth difference is that the Advantage DBI Driver can only produce a forward-scrolling cursor. In most Web applications, this is inconsequential since most CGI applications don’t need to perform any navigation other than forward navigation.

For more information about the Advantage DBI Driver, see the Advantage help files, which can be accessed through perldoc, the integrated Perl help system.




Advantage Database Server. The Official Guide
Advantage Database Server: The Official Guide
ISBN: 0072230843
EAN: 2147483647
Year: 2002
Pages: 129

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net