Perl Operation Sybase

Source: Internet
Author: User
Tags sybase



Setting environment variables


Export perl5lib=:/redhat/perl/lib64/perl5





Installing DBI


 
 
tar -xzvf DBI-1.631.tar.gz
cd DBI-1.631
perl Makefile.PL PREFIX=/redhat/perl
make
make test
make install


Installing DBD


 
tar -xzvf DBD-Sybase-1.15.tar.gz 
cd /redhat/mahy/DBD-Sybase-1.15
perl Makefile.PL MP_AP_PREFIX=/redhat/sybase/OCS-15_0/perl PREFIX=/redhat/perl
make
make test
make install





Script:


 
#!/usr/bin/perl
use strict;
use POSIX qw(strftime);
use DBI;
my $dbh = DBI->connect(‘dbi:Sybase:server=TESTDB;charset=cp936‘,‘USERTEST‘,‘USERTEST‘)|| die "Database connection not made: $DBI::errstr";
my $test_sql = qq{
SELECT count (*) AS num_a,
sum (column_2) AS num_b from TEST_DATA
};
my $sth = $dbh->prepare( $test_sql );
my ($num_a,$num_b);
$sth->execute();
$sth->bind_columns( \$num_a, \$num_b);
while( $sth->fetch() ) {
print $num_a;
print $num_b;
}
$sth->finish();
$dbh->disconnect();


Summarize:
Many articles are installed by default as the root user
In fact, production environment is generally non-root users to install software, easy to generate a variety of resource permissions issues
There is a basic idea for solving the permissions environment problem, which is to specify the installation parameters and set the environment variables



Environment variables are mostly paths



Perl Operation Sybase


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.