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 12 2002 3:48PM

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!