[freetds] FreeTDS + ODBC
kcc1967 at gmail.com
Wed Jul 27 05:04:35 EDT 2005
Thanks for the info. I use ODBC without DM because I don't have
unixODBC, iODBC ... on my system. I'm using SunOS 4.1.4 which
is prettey old.
I found my problem already. I add /etc/odbc.ini and all my problems gone !!!
This may be a bug ??? since I used configuration option
--prefix=/usr/local/freetds to build the source code.
The location of freetds.conf is /usr/local/freetds/etc/freetds.conf,
so I expect that the location of odbc.ini should be
/usr/local/freetds/etc/odbc.ini .... BUT IT'S NOT.
I need to use /etc/odbc.ini to make odbc/unittest PASS.
On 7/27/05, ZIGLIO, Frediano, VF-IT <Frediano.Ziglio at vodafone.com> wrote:
> > Hi,
> > I have freetds-0.63 on Linux connect to MS SQL Server 2000.
> > I have all configure setup correctly and unittest for tds,dblib,ctlib
> > and odbc are ALL PASSed
> > (for ODBC, I use --with-odbc-nodm)
> > And now, I need a static only ODBC driver ... so I add an option
> > to configure, "--enable-shared=no".
> > Everything still working fine except that the ODBC now FAIL
> > with following error:
> > odbctest
> > --------
> > connection parameters:
> > server: 'MyServer2k'
> > user: 'samples'
> > password: 'samples123'
> > database: 'tempdb'
> > Unable to open data source (ret=-1)
> > SQL error S1000 -- [FreeTDS][SQL Server]Unable to connect to
> > data source
> > I didn't change anything !!! It's work fine if shared
> > library is enabed !!!
> > I don't have odbc.ini, just have freetds.conf at
> > /usr/local/freetds/etc.
> > Do I really need odbc.ini. All examples and doc I found show me that
> > in odbc.ini, I need a "Driver" which is a ".so" library ...
> > but now I only use
> > static library and NO so in my build.
> > Do I still need odbc.ini ? How can I setup "Driver" in odbc.ini
> > if I don't have shared library ?
> > Thanks
> > KC
> No, odbc.ini is not required. We do not recommend the use of library
> without DM (driver manager, unixodbc/iodbc/whichever), however someone
> use it in this way. You have to link your program to libtdsodbc.a
> directly, not libodbc.so, so in linker options you should change -lodbc
> with -ltdsodbc. The idea is to call SQLConnect/SQLDriverConnect directly
> from driver (that do not use "Driver" entry in odbc.ini). With
> SQLDriverConnect you can avoid even freetds.conf.
More information about the FreeTDS