|
|
sybperl-l Archive
Up Prev Next
From: "Janarthanan, Prasanna" <Prasanna-Janarthanan at deshaw dot com>
Subject: RE: about CTlibs
Date: Sep 12 2002 4:01PM
thanks a lot ..
my doubt is that .. i will give the uid passwd and server name but i want to
connect to a database named 'production' in that server.. how will i
connect.. to that..
help!
thanks
Prassana
-----Original Message-----
From: Michael Peppler [mailto:mpeppler@peppler.org]
Sent: Thursday, September 12, 2002 9:19 PM
To: SybPerl Discussion List
Subject: Re: about CTlibs
On Thu, 2002-09-12 at 08:18, Janarthanan, Prasanna wrote:
> hi all,
> iam new to sybase. anyways i have a novice doubt.
>
> Can anyone tell me as where to get the sample codes to access the sybase
> database. I have got the peplers code but i want to know as how to connect
> to a database after specifying the server name.?
I'm not exactly sure what you are asking, but here's an example of
connecting to a server using CTlib:
#!/usr/bin/perl -w
use strict;
use Sybase::CTlib;
my $dbh = new Sybase::CTlib 'user', 'password', 'server';
if(!defined($dbh)) {
die "Can't connect to server 'server'";
}
At this point the $dbh will be connected to the server.
You obviously need to supply the correct values for "user", "password"
and "server" for your particular installation.
If the login fails the $dbh variable will be set to the special "undef"
value.
Hope this helps!
Michael
--
Michael Peppler / mpeppler@peppler.org / http://www.mbay.net/~mpeppler
mpeppler@zetatools.com / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!
|