Using Perl and ODBC with PSQL
*Note: This procedure assumes you have a working installation of PSQL v12, 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
1
Read the Readme or INSTALL for instructions.
2
Please see the installation instructions in the Readme or INSTALL file.
3
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"
}