3

I'm trying to create a connection with freetds + unixodbc on Linux to Database on Windows, I configured /etc/freetds/freetds.conf, /etc/odbc.ini and /etc/odbcinst.ini:

freetds.conf:

 A typical Microsoft server
 [wsus]
  host = my-ip-sql-server
  port = 1433
  tds version = 4.2

odbc.ini

[wsus]
  Driver = FreeTDS
  Trace = No
  ServerName = wsus
  Database= Asegurador

as

odbcinst.ini

[wsus]
  Description = tdsodbc
  Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
  Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
  FileUsage = 1
  CPTimeout = 5

Command output = tsql -C :

Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /etc/freetds
     MS db-lib source compatibility: no
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: yes

When I run a tsql the connection is succesfull:

$ tsql -S  wsus -U username -P password
locale is "es_ES.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> select top 1 FechaFactura, Vendedor, ClaseDoc  from [Aseguradoras].[dbo].[mknDetalleAseguradoras]
2> go
FechaFactura    Vendedor    ClaseDoc
2014-07-12         xx           2

But when I run a isql:

$ isql -v wsus username Password [IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified [ISQL]ERROR: Could not SQLConnect

Thanks in advance.

1
  • Just a note, but TDS Version 4.2 is extremely unlikely to be what you want, as it corresponds to SQL Server 6.0. See this helpful documentation: freetds.org/userguide/choosingtdsprotocol.htm Commented May 25, 2015 at 15:22

1 Answer 1

2

In odbcinst.ini, you need to provide the driver name, not the DSN. Change:

[wsus]

to:

[FreeTDS]

You should also modify the TDS version, most likely to 7.3 (SQL Server 2008 - 2014), as mentioned above.

That should do this trick! Good luck.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.