Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

What is required to use Perl on Solaris to connect to MS-SQL?

by mr_perl2002 (Initiate)
on Feb 02, 2002 at 04:49 UTC ( #142882=categorized question: print w/replies, xml ) Need Help??
Contributed by mr_perl2002 on Feb 02, 2002 at 04:49 UTC
Q&A  > database programming


Does anyone have any good install, configuration documentation?
I am having trouble with using-->DBI,iODBC, and DBD::ODBC or -->DBI, FreeTDS, and DBD::Sybase. Are these correct? Are iODBC and FreeTDS both driver managers? Is unixODBC a complete package w/ the driver and manager?

The Rookie

Answer: What is required to use Perl on Solaris to connect to MS-SQL?
contributed by andreychek

You don't state what version of SQL Server you're using. In general though -- if SQL Server is configured to listen for connections on a port (as opposed to something like named pipes), you should be able to get it to work.

One method works is to install the latest version of FreeTDS (which is currently 0.53). Then edit /etc/freetds.conf (or where ever the installation put it) and insert the settings that correspond to your database (hostname, username, password, etc).

Then, install DBD::Sybase, and you should be good to go. Just be sure to insert the following code at the top of all your scripts using the database:

BEGIN { $ENV{SYBASE} = '/usr'; }
Substitute /usr for the actual prefix FreeTDS was installed under on your system.

Without this code, or when using incorrect parameters to send to the database, it often just segfaults. The FreeTDS and DBD::Sybase docs should be able to help you get the correct parameters to use though. Good luck!
Answer: What is required to use Perl on Solaris to connect to MS-SQL?
contributed by gellyfish

As well as being ability to build DBD::Sybase against FreeTDS there is also DBD::FreeTDS which whilst not as mature as DBD::Sybase should be free of the problem that lachoy mentions.

Answer: What is required to use Perl on Solaris to connect to MS-SQL?
contributed by Zombie jklowden

The author of DBD::Sybase, Michael Peppler, keeps it current. He coordinates his work with us on FreeTDS, and is very helpful in guiding the FreeTDS CT-lib implementation. DBD::Sybase + FreeTDS is the most mature open-source platform you'll find for connecting unixy clients to MS SQL Server.

There were some niggles with the latest releases (DBD::Sybase 93 and FreeTDS 53), but that's all solved now. Far from using older versions, I'd advise taking the nightly snapshot from

If you want to use ODBC, have a look at the FreeTDS User Guide first, to see what's what.

Answer: What is required to use Perl on Solaris to connect to MS-SQL?
contributed by lachoy

In addition to what andreychek said, be sure to read the FAQ for FreeTDS. Newer versions of DBD::Sybase are said to be more reliant on functions only in the Sybase Open Client libraries so you need to use a slightly older one.

Answer: What is required to use Perl on Solaris to connect to MS-SQL?
contributed by mpeppler

Friend lachoy is correct - DBD::Sybase does use a wider range of Client Library API calls in recent versions.

However, FreeTDS is progressing nicely so that all versions of DBD::Sybase build with the current release (AFAIK), even though some of the functionality won't work, or won't work correctly.

I try to keep an eye on the FreeTDS developpment (even though I don't actually do any of the coding myself) to keep track of the most important issues.


Answer: What is required to use Perl on Solaris to connect to MS-SQL?
contributed by Anonymous Monk

I successfully connect to MS-SQL 2000 from a Solaris box. Here is a list of what I used and in the order in which I compiled and installed the packages:

  • freetds-0.61
  • DBD-Sybase-0.91
# Here's my connection string my $dbh = DBI->connect("dbi:Sybase:server=DDSql;database=toto", 'sa', +'pass', { RaiseError => 1, AutoCommit => 0 });
where DDSql is a DNS established in the freetds.conf file. It looks something like:
[DDSql] host = port = 1433 tds version = 8.0 emulate little endian = yes

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [1nickt]: I just got my feet wet with some DBIC coding this last week. I feel "meh" about it so far. It was pretty easy to add a sub to the DBIC class to filter search results ...
    [1nickt]: ... in the calling code ... $rs = $rs->maturity(" stable");. But I don;t enjoy feeling that far away from the SQL and the DB, really.
    [1nickt]: The same project (CPAN Testers API) is using experimental signatures (and therefore 5.024) ... which is what replaced Method::Signatures , afaict.
    [1nickt]: But the new $job is on an older Perl and therefore using M::S, the syntax of which looks clunky to me, so far.

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (6)
    As of 2017-11-24 13:34 GMT
    Find Nodes?
      Voting Booth?
      In order to be able to say "I know Perl", you must have:

      Results (349 votes). Check out past polls.