[unixODBC-support] Can't connect WAS: unixODBC-support Digest, Vol 102, Issue 3

barsalou barjunk at attglobal.net
Mon Apr 8 23:05:45 BST 2013

>> I installed unixodbc and freetds, but when I try to establish a
>> connection via php I receive this error message:
>> Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open
>> lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2260.0' : file
>> not found, SQL state 01000 in SQLConnect in ......
>> Actually '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2260.0' is
>> existant on exactly this path.
>> But I realized in my php script that the file mentioned in this line
>> putenv("FREETDSCONF=/etc/freetds/freetds.conf");
>> What happens when you do the steps here?
>> http://freetds.schemamania.org/userguide/confirminstall.htm
> web2:/ # tsql -C
> Compile-time settings (established with the "configure" script)
>                             Version: freetds vdev.0.92.377
>              freetds.conf directory: /usr/local/etc
>      MS db-lib source compatibility: no
>         Sybase binary compatibility: no
>                       Thread safety: yes
>                       iconv library: yes
>                         TDS version: 5.0
>                               iODBC: no
>                            unixodbc: yes
>               SSPI "trusted" logins: no
>                            Kerberos: no
> Then to
> ---------------------------------
> Example 3-3. Failure to find servername in freetds.conf
> 	$ tsql -S nobox -U sa
> ---------------------------------
> What do I enter for 'nobox' and what for 'sa'? 'nobox' the server's hostname?

According to the manpage here: http://linux.die.net/man/1/tsql

-S servername

the Database Server to which to connect.

-U username
database login name

Skip down to "Bypassing freetds.conf" and give that a try.  You may  
have to read the entire troubleshooting guide a few times before  
things get a little clearer, but it should help you narrow the issue  

If you do the Bypassing section and it succeeds, then you know at a  
minimum, you can connect to the server from that box.  When that  
works, then you can figure out how to get it to use the freetds  
configuration files.

If my memory serves and you are connecting to an MSSQL server, there  
may be some things you have to do to enable access from outside of the  
actual server.

As a super basic test you ought to be able to use telnet to try and  
connect to the box:

telnet <ip address> <MSSQL port>

And it should at least come back with some sort of message about the server.

Look here for some possible help on how to find the port the MSSQL  
server is running on:  

>> Are you sure thats the right lib? That looks like a MS driver, not freetds.
>> But is thats what you expect, its probably a lib that hat driver needs
>> that is missing. Try
>> ldd /opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2260.0
> web2:/ # ldd /opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2260.0
>         linux-vdso.so.1 =>  (0x00007fffab9ff000)
>         libcrypto.so.0.9.8 => not found
>         libdl.so.2 => /lib64/libdl.so.2 (0x00007f874aaf6000)
>         librt.so.1 => /lib64/librt.so.1 (0x00007f874a8ed000)
>         libssl.so.0.9.8 => not found
>         libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f874a6e7000)
>         libodbcinst.so.1 => /usr/lib64/libodbcinst.so.1 (0x00007f874a4cf000)
>         libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00007f874a204000)
>         libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2
> (0x00007f8749fcd000)
>         libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f8749cc3000)
>         libm.so.6 => /lib64/libm.so.6 (0x00007f8749a6c000)
>         libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f8749855000)
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8749638000)
>         libc.so.6 => /lib64/libc.so.6 (0x00007f87492d8000)
>         /lib64/ld-linux-x86-64.so.2 (0x00007f874b0d9000)
>         libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00007f87490b0000)
>         libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f8748eac000)
>         libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0
> (0x00007f8748ca3000)
>         libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f8748a9f000)
>         libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f8748888000)

This may not be impactful for your immediate issues, but it looks like  
the openssl libraries are not there. Notice the 'not found' messages.

Mike B.

This message was sent using IMP, the Internet Messaging Program.

More information about the unixODBC-support mailing list