[ic] connecting to sybase

Klaus Koch kkoch@kxsu.de
Wed, 14 Mar 2001 15:13:28 +0100 (MET)


hello!

i have to switch a running shop from mysql to sybase anywhere studio.
i installed the ASAny DBI driver and i am able to connect with a perl
script and recieve data (i copied this script to the end of this mail).

the running sybase server is named cc-shop and the database is called
cshop.

but i cant figure out how to connect with the shop to the new database
i tried this (and many similar) configuration:

Database            products products dbi:ASAny:cshop
Database            products    USER    ic
Database            products    PASS    123456
Database            products    ENG     cc-shop

i dont know if i can pass ENG simply like this (compare perlscript).

please, can someone who works with a sybase server help me? i just dont
know what to do now...

many thanks in advance!

klaus


this is the perl script which recieves data from the database:

#!/usr/bin/perl -w
use DBI;
use strict;
my($database) = "CSHOP";   
my($data_source) = "DBI:ASAny:$database";
my($username) = "UID=ic;PWD=123456;ENG=cc-shop";
my($sel_statement) = "SELECT code,searchspec,ref01 FROM artikel";
my($dbh) = &db_connect($data_source, $username, '');
&db_query($sel_statement,$dbh);
$dbh->disconnect;
exit(0);

sub db_connect {
        my($source,$user,$pass) = @_;
        my($dbh) = DBI->connect($source, $user, $pass);
        return($dbh);
}

sub db_query {
        my($sel,$h) = @_;
        my($row,$sth) = undef;
        $sth = $h->prepare($sel);
        $sth->execute;
        print "Names:      @{$sth->{NAME}}\n";    
        print "Fields:     $sth->{NUM_OF_FIELDS}\n";
        print "Params:     $sth->{NUM_OF_PARAMS}\n";
        print "\nFirst Name\tLast_name\tTitle\n"; 
        while($row = $sth->fetch) {
           print "@$row[0]\t@$row[1]\t\t@$row[2]\n";
        }
        $sth->finish;
}
__END__