Pervasive logo

Prev Getting Started with Pervasive.SQL (Server edition) Next

Using Perl and ODBC with Pervasive.SQL for Linux



Note
This procedure assumes you have a working installation of Pervasive.SQL V8, Perl, and an ODBC distribution. A free version of ODBC is available at http://www.iODBC.org. Perl can be found at http://www.perl.org

   To Get Pervasive.SQL to work with Perl's ODBC Interface:

  1. Download the DBI (database interface) support for Perl.

    Read the README or INSTALL for instructions.

  2. Download the ODBC DBD database driver for Perl.

    Please see the installation instructions in the README or INSTALL file.

  3. Make sure you have the proper environment variables set, as shown in the following example. Note, this is also explained in the iODBC docs.

Code Snippet for Perl and DBI

print "using odbc...\n"; 
use DBI; 
$dbName = "DBI:ODBC:DEMODATA"; 
$dbUserName = ""; 
$dbPassword = ""; 
print "connecting...\n"; 
$sql = "SELECT * FROM class"; 
$dbh = DBI->connect($dbName, $dbUserName, $dbPassword); 
$dataObject = $dbh->prepare($sql); 
$dataObject->execute(); 
while(@row=$dataObject->fetchrow_array) 
{ 
print "$row[0]\t$row[1]\t$row[2]\n\n" 
} 

Prev
Setting Up Web-based Data Access on Linux
Contents
Up
Check for Revisions
Next
Pervasive.SQL Clients: Installing and Configuring