This assumes that you have perl 5x installed, and CPAN as well....
- Update CPAN to the current available version
- cpan > install Bundle::CPAN
- Use CPAN to install the DBI::Bundle
- cpan > install Bundle::DBI
- Install Freetds
- Download files from here
- Gunzip and untar the freetds tar.gz file
- Read the README!
- Run configure tool to customize for your system
- ./configure
- Install freetds
- ./make install
- Add valid SQLServer info to /usr/local/etc/freetds.conf
[{server_connection_name}]- host = {server dns name or ip}
port = {1433}
tds version = 8.0 - Use CPAN to install the DBD::Sybase
- Set SYBASE environment variable to /usr/local
- cpan > force install DBD::Sybase
- Test the install with a perl connection script
#!/usr/bin/perl
#
# test the perl freetds dbi driver
#
use DBI ;
$user = '{dbuser}' ;
$passwd = '{dbpass}' ;
$dbh = DBI->connect('DBI:Sybase:server={servername}',
$user, $passwd);
$dbh->do("use {dbname}");
$action = $dbh->prepare("select count(*) from master..sysprocesses with (nolock)") ;
$action->execute ;
$rows = $action->rows ;
print "rows is $rows\n";
while ( @first = $action->fetchrow_array ) {
foreach $field ( @first ) {
print "$field\t";
}
print "\n";
}
exit(0);
No comments:
Post a Comment