[freetds] Question: configuration of FreeTDS 0.64 with unixODBC-2.2.12 to MS SQL Server 2000

James K. Lowden jklowden at freetds.org
Thu Dec 7 00:08:42 EST 2006


Jan Lubbers wrote:
> Hi all,
> 
> I'm new to this list...
> 
> I need some help to get going as I'm lost now.
> 
> I want to query a SQL Server database from Linux. This should be fairly
> easy, reading the docs. However, I still cannot get it to work.
...
> -----------------------------------------------------------------------
> -------- /usr/local/etc/freetds.conf
> <no changes made>
> -----------------------------------------------------------------------
> -------- tsql -C:
> Compile-time settings (established with the "configure" script):
>                            Version: freetds v0.64
>     MS db-lib source compatibility: yes [ALSO TRIED: no]
>        Sybase binary compatibility: unknown
>                      Thread safety: yes
>                      iconv library: yes
>                        TDS version: 5.0 [ALSO TRIED: 8.0]
>                              iODBC: no
>                           unixodbc: yes
> -----------------------------------------------------------------------
> --------

Using tsql without adding your server to ${HOME}/.freetds.conf is tricky,
because without it, the library doesn't know which TDS version the server
uses.  It tries with the compiled-in default (unless TDSVER is set), which
gives you roughly 50-50 odds of making a connection.  

Try adding a freetds.conf entry like this:

[lt06040]
        host = lt06040
###     port = 1433
        tds version = 8.0

(I think the default port these days is inferred from the TDS version.)  

Then you should be able to connect:

	$ tsql -S lt06040 -U sa -P sa

If that doesn't work, 

	$ export TDSDUMP=dump
	$ tsql -S lt06040 -U sa -P sa
	$ less dump

to make sure it's using the file and connecting to (or trying) the right
address and port.  

Once you have that working, ODBC is the next step.  Recent snapshot
include my "osql" shell script, which tests your configuration files
before invoking unixODBC's isql.  You can just download last night's
snapshot and extract the script.  If you try it, please let me know how it
works out for you.  

HTH.  

--jkl



More information about the FreeTDS mailing list