Accessing Pervasive.SQL With Perl

Page Last Modified: 06/11/15

Home Links ODBC (DBI) Contact

DBI::ADO - Examples - using an ODBC data store

Without an OLEDB data provider we can use an ODBC datasource instead:

use strict;
use warnings;
use DBI;

# DBI->ADO->ODBC->PSQL
my $DSN = 'demodata';
my $dbh = DBI->connect("dbi:ADO:$DSN", '', '', { RaiseError => 1 });

if(defined($dbh))
{
my $query = 'SELECT Name FROM demodata.Class';
my $arrayRef = $dbh->selectall_arrayref($query);
my $rowCount = @$arrayRef;

foreach my $row (@$arrayRef)
{
print "Value: $$row[0]\n";
}

print "$rowCount rows returned\n";
$dbh->disconnect();
}

Home Links ODBC (DBI) Contact

All content on this site is copyright
Neil Hughes 2010 - 2018