Skip to Content.
Sympa Menu

freetds - [freetds] I found the exact reason why the odbc driver of FreeTDS can't work with iODBC, but I don't know how to solve it.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Ou Liu" <ou AT qbt.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] I found the exact reason why the odbc driver of FreeTDS can't work with iODBC, but I don't know how to solve it.
  • Date: Fri, 6 Dec 2002 12:16:51 -0500

Hi, everyone

The exact reason which makes the odbc driver of FreeTDS can't work
with
iODBC is that the program used the SQLAllocEnv of iODBC instead of the
SQLAllocEnv of FreeTDS's ODBC driver which it should use. Let me make it
clear:

0. Environment and comiling settings:
----------------------------------------------------------------------------
------------------------------------
Hardware: SPARC (Sun Blade 100)

OS: Solaris 8

Compiler: gcc (2.95 or lower, I don't know, maybe it is the
problem)

Compiling Setting for the iODBC:
configure --disable-gui --disable-gtktest --prefix=/usr/local/iodbc
AR=/usr/ccs/bin/ar RANLIB=/usr/ccs/bin/ranlib

Compiling Setting for the freetds:

configure --with-iodbc=/usr/local/iodbc --prefix=/usr/local/freetds --with-t
dsver=7.0 AR=/usr/ccs/bin/ar RANLIB=/usr/ccs/bin/ranlib
----------------------------------------------------------------------------
------------------------------------

1. I use the /FREETDSHOME/src/odbc/unittest/connect.c to test the odbc
driver, now the "main" fucntion of connect.c will call this function in
common.c which is located at the same directory:

----------------------------------------------------------------------------
------------------------------------
connect();
----------------------------------------------------------------------------
------------------------------------

2. This "connect" function includes lines:
----------------------------------------------------------------------------
------------------------------------
if (SQLAllocEnv(&Environment) != SQL_SUCCESS) {
printf("Unable to allocate env\n");
exit(1);
}
if (SQLAllocConnect(Environment, &Connection) != SQL_SUCCESS) {
printf("Unable to allocate connection\n");
SQLFreeEnv(Environment);
exit(1);
}
----------------------------------------------------------------------------
------------------------------------

3. Now there is also a SQLAllocEnv in the henv.c which is located at
/IODBCHOME/iodbc/, also a SQLAllocConnect in the hdbc.c at the same
directory.
Strangely, the call to SQLAllocEnv will use the function of iODBC
which is
from henv.c and the call to SQLAllocConnect will use the function in odbc.c
which is located at /FREETDSHOME/src/odbc.
Of course there is problem, since iODBC knows nothing about the TDS,
so it
can't initialize the Environment correctly, so the SQLAllocConnect of odbc.c
will crash.
4. My question is:
1. How to tell the linker or compiler to use the SQLAllocEnv in odbc.c
instead of the iODBC's version. My gcc have a version no more than 2.95 (In
fact when compiling, there do have a warning, but I didn't really understand
it), maybe that's the problem? I know it maybe a foolish problem, but I
really know almost nothing about gcc.
2. After solved problem 1, will there be more problem which is
induced by
two functions having the same name while doing different things?

Any suggestion and help is greatly appreciated

Ou





Archive powered by MHonArc 2.6.24.

Top of Page