[ic] connecting to sybase

Mark Johnson markj@redhat.com
Wed, 14 Mar 2001 10:03:29 -0500


I would guess that the actual connect call looks something like this:

DBI->connect(SQLDSN,SQLUSER,SQLPASS);

Given that, I would "try"

SQLDSN  "DBI:ASAny:CSHOP"
SQLUSER  "UID=ic;PWD=123456;ENG=cc-shop"
SQLPASS

Another possibility would be adding the ENG directive to SQLDSN:

DBI:ASAny:CSHOP;ENG=cc-shop

Or, scour the man page for DBD::ASAny for alternative syntax.

Good luck!


Klaus Koch wrote:
> 
> 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__
> 
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users

-- 
Mark Johnson
Senior Developer - Professional Services
Red Hat, Inc.
E-Business Solutions
markj@redhat.com
703-456-2912