Re: multithreaded ODBC application

From: Jonathan Lent <jlent3_at_jcpenney.com>
Date: 1996/08/13
Message-ID: <3210BE83.130B_at_jcpenney.com>#1/1


Joey Lim wrote:
>
> I have an object that started another CWinThread object as a
> child thread to perform ACCESS and ORACLE synchronization using ODBC.
> Oracle is connected via phone line. Everything works OK until, the
> thread ended and when any variable in parent thread was accessed -- I
> got access violation. No variable was being shared, except one. I got
> lazy, and created a shared BOOL variable to notify parent that the child
> has endedits thread. I did use ENTER and LEAVECRITICALSECTION accessing
> this variable. Microsoft documentation did specify that not all ODBC is
> thread-safe. However, I don't have multiple ODBC threads.
>
> Any help you can provided will be greatly appreciated. Anything I can
> do in return, please, just ask.
>
> Regards,
> Joey.

SQL*Net does not deal well with threaded applications. It limps along on
some platforms and simple breaks on others. I've had nothing but heartache trying to get IIS to work with Oracle 7 via ODBC. Admittedly, you probably have 100 times the knowledge on thre programming that I do, but I have a sneaky suspicion that you are running into a related problem.
Here is a piece of text from a Microsoft note on the problem:

--<snip>------------------------------------------------------------------
Background: We're fairly confident there's a bug in the Oracle supplied SQL*Net drivers relating to thread initialization. The SQL*Net drivers rely on getting the THREAD_ATTACH notification in their DLL entrypont. Since IIS delays loading the IDC (and subsequently the Oracle drivers), the SQL*Net driver does not receive notification of the existing threads in the server. This leads to access violations in ORANT71.DLL (or ORA72.DLL) when running queries against an Oracle datasource.
--<snip>------------------------------------------------------------------

Hope this helps you. Good luck.

-Jonathan Lent Received on Tue Aug 13 1996 - 00:00:00 CEST

Original text of this message