PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: RE: about CTlibs
Date: Sep 13 2002 8:18AM

On Thu, 2002-09-12 at 09:01, Janarthanan, Prasanna wrote:
> 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.. 

$dbh->ct_sql("use $dbname");

is probably the simplest way of doing that.

Michael



> -----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!
> 
> 
-- 
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!