Skip to Content.
Sympa Menu

freetds - Re: [freetds] Possible problem with ODBC

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Alex Hornby <alex AT anvil.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] Possible problem with ODBC
  • Date: 07 Feb 2003 09:49:13 +0000

On Thu, 2003-02-06 at 21:57, Craig Davison wrote:
> Hi again,
>
> Is it possible to have two queries executing at once with the freetds ODBC
> driver? I've made a small test program that attempts this and it does not
> seem to work. (Change "user", "password" and "mydb" in main() to
> appropriate values to run)
>
> The program is attached. It creates a statement handle and selects from
> the master..sysusers table. For each row returned, it performs another
> query. (Note that the program doesn't do anything useful at all, but the
> code should be legal).
>
> The "inner" SQLExecDirect returns -1 and SQLGetDiagRec provides no
> further details. I'm using 0.61rc1 on a RedHat 8 (x86) client, with an MS
> SQL Server 2000 server. My ODBC driver manager is UnixODBC 2.2.2.
>
> It could be that I've got some major oversight happening, as I'm still new
> to ODBC, but I can't seem to figure out why this isn't working.
>
> Thanks!
>

Hi Craig,

I think this is because FreeTDS is using the "single select" parts of
the TDS protocol, this is efficient but the price you pay is that you
can only have one active statement at a time per TDS connection.

The ODBC driver alternatives are:

* to use a cursor based design for the ODBC driver. This is the closest
mapping to the ODBC design, but may be slightly slower.

OR

* to allow the ODBC driver to open multiple connections for multiple
statements. This does however use up a limited server resource and has
problems with transactions.

OR

* you can redesign you application to never have more than one result
set open. For existing applications this is likely to be disruptive.


Cheers,
Alex.





Archive powered by MHonArc 2.6.24.

Top of Page