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

I'm trying to use FreeTDS with the DBD::Sybase libraries to connect from a Linux machine (RedHat 6.2 with the 2.4.0 kernel) to an NT box running MS SQL 7 with SP3. I've installed FreeTDS and added the SQL server to the interphaces file. When I try to execute the program, I'm getting an error: "connect: Network is unreachable". I can ping the DB server so it's not a network problem. I suspect it has something to do with my configuration, but I'm new to the DBI, as well as FreeTDS. Any ideas? This may seem like an elementary question, but this is new territory for me. Thanks.

Replies are listed 'Best First'.
Re: FreeTDS problem
by lachoy (Parson) on Jun 05, 2001 at 18:23 UTC

    Couple of things:

    • Do you have an entry defined for $ENV{SYBASE}? This should point to your FreeTDS home directory (e.g., /usr/local/freetds)
    • Did you define your servers in /usr/local/freetds/interfaces? There are default entries there which you might be trying to access that are defined for a network you can't reach (thus the error message). The format of the interfaces file is pretty simple and you should be able to follow the examples.
    • Did you see the FreeTDS FAQ?

    I have gotten this combination to work, although some of the metadata capabilities from DBD::Sybase weren't available. Simple stuff was ok.

    hope this helps

    Chris
    M-x auto-bs-mode

      I've tried all of this with no change to my results. And yes, I've stared the the FreeTDS FAQ until my eyes hurt. Thanks for the effort, anyway.
        Does your server run on default port? May be you need additional configuration of your interfaces in your freetds.conf or interfaces. For example, in my freetds.conf I have the following section:
        [WEBCOOL] host = 10.0.0.13 port = 9100 tds version = 7.0 text size = 10000
        -- yuriy
Re: FreeTDS problem
by enoch (Chaplain) on Jun 05, 2001 at 19:17 UTC
    I, too, have done this. Actually, I do it quite often because I keep playing with all of the settings. Here is my list of what I do.

    1) Configure FreeTDS './configure --prefix=/usr/local/freetds --with-tdsver=4.2'
    2) make FreeTDS 'make'
    3) 'make install'
    4) Configure Apache './configure --prefix=/usr/local/apache'
    5) go to /etc/ld.so.conf and add '/usr/local/freetds/lib'
    6) run 'ldconfig'
    7) write your interface file for FreeTDS
    8) in httpd.conf write 'SetEnv SYBASE /usr/local/freetds'

    That should do it.

    Jeremy
      I have tried all of this (except the Apache thing, since I'm running the script from a terminal, it's not CGI). I also tried the 2.2.19 kernel, with no change. I had set the SYBASE variable in the profile, so it would be system wide. I am wondering if I've missed some other requirement, like having SAMBA running, or possibly something running on the NT machine?
Re: FreeTDS problem
by hacker_j99 (Beadle) on Aug 11, 2001 at 03:26 UTC
    Did you ever get the problem solved... I am at the same point as you (maybe a little further) and my eyes are shoot as well.. I have SYBASE set and all the rest... TDS works for me but it hangs on CTlib and Its needed to stop my Sybperl from geting segmentation faults.

    Hacker_J99
    UTC File Server for all your File needs