Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Unable to connect to MSSQL DB using DBD::Sybase

by msk_0984 (Friar)
on Aug 14, 2009 at 13:46 UTC ( [id://788639]=perlquestion: print w/replies, xml ) Need Help??

msk_0984 has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I need to develop an application which should connect to MSSQL Database and execute few queries and display them on the screen.

Installed the following perl modules successfully on Linux server

1. DBI 1.54

2. DBD::Sybase 1.08

3. Free TDS 0.82

Also set the Sybase env variable and written a small script initially to test the connection using perl script. We are able to connect to the DB from the CLI with freetds using the below command

./tsql -p 1433 -S DB -U test -P test locale is "C" locale charset is "ANSI_X3.4-1968" 1>
But unable to connect to the database through script.

Below is a part of the script used to connect to the Database, please review the script and let me know if I am doing any thing incorrect.

use DBI; my ($user_id,$pass,$dsh,$sth,$dbh); $user_id = 'test'; # username $pass = ''; #password $hostname='station100'; #hostname $port='1433'; # mssql server port $databasename='HHC_PORTAL_GUI'; # database name $tablename='Services'; $ser='HHC_DS'; # Connect to the MS SQL database $dbh = DBI->connect("dbi:Sybase:host=$hostname;port=$port;serv +er=$ser;database=$databasename", $user_id,$pass,{PrintError=>'1',Rais +eError=>'1'});

Thanks In Advance

Sushil Kumar

Replies are listed 'Best First'.
Re: Unable to connect to MSSQL DB using DBD::Sybase
by derby (Abbot) on Aug 14, 2009 at 13:54 UTC

    What error message are you getting from DBI? Your tsql script is connecting to a different server (DB) than your perl script (HHC_DS). Is HHC_DS defined in interfaces or freetds.conf file?

    -derby

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://788639]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-25 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found