in reply to Re: Re: Connecting to a MS SQL 2k Server
in thread Connecting to a MS SQL 2k Server

Since we are on this thread, perhaps I should mention that I have been struggling to connect to MS SQL via DBD::Sybase for the last two days. Connection to Sybase/Linux via DBD::Sybase is just fine, but connecting to MS SQL 2000 leads to problems
use DBI; my $data_source = "dbi:Sybase:database=SynergyOne;server=MSSQL"; my $username = 'sa'; my $auth = ''; + + my $dbh = DBI->connect($data_source, $username, $auth) or die "no connection: $DBI::errstr";
[tbone@MDB tbone]$ ~/bin/db-connect.pl DBI connect('database=SynergyOne;server=MSSQL','sa',...) failed: at / +home/tbone/bi\ n/db-connect.pl line 9 no connection: OpenClient message: LAYER = (1) ORIGIN = (2) SEVERITY = + (6) NUMBER = (151) Message String: ct_connect(): user api layer: internal Client Library +error: A connection to the server must exist on the connection struct +ure before this routine can be called. [tbone@MDB tbone]$

Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality

Replies are listed 'Best First'.
Re: Re: Re: Re: Connecting to a MS SQL 2k Server
by dragonchild (Archbishop) on Jul 25, 2003 at 16:37 UTC
    Are you using freetds? If you are, what is the content of your freetds.conf file? Where does it live? freetds has a good manual and, in it, it has a pretty large section on connecting to MS-SQL. I'd RTFM first.

    For your reference, my .freetds.conf looks like:

    [global] tds version = 4.2 textsize = 10000 [MY_SERVER] host = 123.456.78.90 port = 1433

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Re: Re: Re: Re: Connecting to a MS SQL 2k Server
by mpeppler (Vicar) on Jul 25, 2003 at 18:46 UTC
    If you are attempting to connect to MS-SQL with Sybase's OpenClient libs then that's likely to fail (unless you have some specific version of MS-SQL 7 that supports the Sybase client libs).

    If you are using FreeTDS - could you please run the same script with DBI->trace(3) and post or email me the output?

    Thanks,

    Michael