|
|
sybperl-l Archive
Up Prev Next
From: bv1 at dsunix2 dot dsrd dot ornl dot gov (Ron Browning)
Subject: Re: Sybperl query
Date: Nov 21 1995 7:28PM
>Shankar Kris writes:
>> On Tue, 21 Nov 1995, Mark Lonsdale - System Services wrote:
>> > What I want to do within my script is to log into 2 different servers
which
>> > are referenced in 2 seperate interfaces files. I assumed that sybperl
would
>> > look for the interfaces file in the location specified by the SYBASE
variable.
>> > Assuming this what I have done is as follows :-
>> >
>> > $ENV('SYBASE')="/tmp/firstlocation";
>> >
>> > $firstconnection=&dblogin($user, $password, $firstserver)
>> >
>> > $ENV('SYBASE')="/tmp/secondlocation";
>> > $secondconnection=&dblogin($user, $password, $firstserver);
>>
>> shouldn't this be,
>> $ENV{'SYBASE'} = "....";
>> $firstconnection =.....
>>
>> probably your script never read the SYBASE env thru your program
>> but read the value from a previously set environment.
>
>Right, check your $ENV{...} references for 'SYBASE', as well as all other
>associative array references. (Check the FAQ or Camel book if you're not
>clear on how associative array references are done.)
>
>The other thing you might have to do is declare your "interfaces" files,
>as follows:
>
> &dbsetifile("$SYBDIR[0]/interfaces");
> $ENV{'SYBASE'} = $SYBDIR[0];
> $connection[0] = &dblogin($user[0],$password[0],$server[0]);
> &dbsetifile("$SYBDIR[1]/interfaces");
> $ENV{'SYBASE'} = $SYBDIR[1];
> $connection[1] = &dblogin($user[1],$password[1],$server[1]);
> ^^^^^^^^^^
> (You use $firstserver in your code above,
> but the second time, you want the _second_
> server, right? :-)
>
>I started using &dbsetifile() when I moved my SybPERL program to a Solaris
>client (where I built "sybperl" using Sybase 10.x DBLib) talking to a 4.9.2
>server running on a SunOS 4.1.x host. (The "interfaces" files' formats
>differ between the two releases.) I haven't tried, but I would _think_
>that you should be able to make a second &dbsetifile() call after logging
>into the first server. Check the DBLib reference manual, to see if there
>is any mention of this there. (I would, but mine's not handy right now...)
>
>Let us know if your experimentation turns up anything of interest in this
>area. I would expect that we'll see more and more of these questions as
>people continue to migrate to System 10, and eventually on to System 11
>as well.
>
Unless the names of the servers are the same, why not have the reference to
both servers in the same interface file?
Ron Browning Lockheed Martin Energy Systems
Internet: bv1@ornl.gov MS 7618
Phone: (423) 574-6583 1099 Commerce Park Dr.
Fax: (423) 574-0792 Oak Ridge, TN 37830-8076
|