Skip to Content.
Sympa Menu

freetds - [freetds] Getting ODBC working

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO Frediano" <Frediano.Ziglio AT vodafone.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Getting ODBC working
  • Date: Thu, 13 Nov 2003 17:34:59 +0100

Just some lines to get ODBC working in minutes (if all work as
expected). It assume you are using GNU iconv (or Linux implementation)
and unixODBC as DriverManager

- check that unixODBC is installed
# isql
(should find the command)

- download freetds from www.freetds.org

- decompress it
# tar zxvf freetds-XXXX.tar.gz

- configure build. Usually this step do not require strange
configurations. If unixODBC is installed in default directory (/usr)
configure should detect and enable unixODBC, if not add
--with-unixodbc=unixodbc_directory to configure command
# cd freetds-XXXX
# ./configure

- compile it
# make

- configure FreeTDS for a test
# cp freetds.conf $HOME/.freetds.conf
you should add a section to $HOME/.freetds.conf with server
information
[myserver]
host = dns_resolvible_name_or_ip
port = sql_server_port
tds version = protocol_version
For instance
[myserver]
host = 10.2.3.4
port = 1433
tds version = 7.0
Refer to UserGuide if you don't know some values (usually port=1433
for mssql, tds version 7.0 (mssql7), 8.0 (mssql2k), 5.0 (sybase) )

- check FreeTDS
# ./src/apps/tsql -Smyserver -Uusername -Ppassword
and hit some SIMPLE query (like "select @@version")

Msg 5703, Level 0, State 1, Server OPDN014, Line 0
Changed language setting to us_english.
1> select @@version
2> go

Microsoft SQL Server 2000 - 8.00.534 (Intel X86)
Nov 19 2001 13:23:50
Copyright (c) 1988-2000 Microsoft Corporation
Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack
4)

- exit tsql
1> bye

- configure your $HOME/.odbc.ini with a server that point to FreeTDS
configuration and to your driver
[odbcserver]
Driver = current_directory/src/odbc/.libs/libtdsodbc.so
Servername = myserver

- test your odbc configuration with isql
# isql odbcserver username password
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> select @@version
+-----------------------------------------------------+
| |
+-----------------------------------------------------+
| Microsoft SQL Server 2000 - 8.00.534 (Intel X86)
Nov 19 2001 13:23:50
Copyright (c) 1988-2000 Microsoft Corporation
Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack
4) |
+-----------------------------------------------------+
1 rows affected
1 rows returned
SQL> quit

Usually this work for me...

freddy77



  • [freetds] Getting ODBC working, ZIGLIO Frediano, 11/13/2003

Archive powered by MHonArc 2.6.24.

Top of Page