|
|
sybperl-l Archive
Up Prev Next
From: Riyaz Ahmed Vali <riyaz at wilco-int dot com>
Subject: RE: about CTlibs
Date: Sep 12 2002 6:45PM
You could just execute a simple "use my_database" command! like ...
$dbh->ct_execute("use my_db");
while($dbh->ct_results($restype) == CS_SUCCEED) {
next unless $dbh->ct_fetchable($restype);
while($dbh->ct_fetch) {};
}
hth! Riyaz.
_________________________________________________________________________
Riyaz Ahmed Vali * +91-40-340 8600 x8588
> -----Original Message-----
> From: Janarthanan, Prasanna [SMTP:Prasanna-Janarthanan@deshaw.com]
> Sent: Thursday, September 12, 2002 9:31 PM
> To: SybPerl Discussion List
> Subject: RE: about CTlibs
>
> 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!
This message is confidential and may also be legally privileged. If you are not the intended recipient, please notify postmaster@wilco-int.com immediately. You should not copy it or use it for any purpose, nor disclose its contents to any other person. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of Wilco.
|