HI Sebastian,
I am using libiodbc to access the Virtuoso server. Thus, I am
creating a
HENV instance via SQLAllocHandle( SQL_HANDLE_ENV,
SQL_NULL_HANDLE, &henv )
and then a
HDBC intance via SQLAllocConnect( henv, &hdbc ) and
SQLDriverConnect(
hdbc, ... )
Atm I am using the HDBC instance throughout multiple threads and am
experiencing some crashes which I think are related to that.
So my question is simple: should HDBC be thread-safe or am I
supposed to
create one connection for each thread?
iODBC itself is (or should be) completely thread safe, so i would
like to know more about the access pattern you are using, if you have
log files and/or core dumps we can analyze together etc.
You can send logs etc directly to my account, since these do not
belong on the list.
However since you are using 1 connection over all threads, there is a
risk that you are at least partially serializing your requests since
all SQLAllocStmt handles will lock the same connection. So if your
threads are constantly creating and dropping statement handles, you
should really consider creating a HDBC per thread. That would
maximize the parallelism of your code.
Patrick