[freetds] Querying from multiple threads - SEGMENTATION FAULT
sohaibrasheed at yahoo.com
Fri Dec 30 00:28:49 EST 2005
I am facing a problem using TDS. The problem occurs only when using multiple threads to access SQL Server 2000. The current scenerio is that whenever I need to query database in a thread, the thread opens the db (dbopen), executes the query, checks the results etc and in the end closes the db connection (dbclose). The problem arrises when while a thread is processing the results, the other thread calls dbopen to open a connection with same LOGINREC. Sometimes it even occurs in other states as well and results in segmenation fault. I used another approach to solve this problem and that was to create a connection pool and give a free connection to a thread and calling dbcancel before binding parameters and executing the query. Everything worked fine until a special case arrived. If I bind a varchar parameter will NULL value (NULL acceptable in SP) and specify maximum length = -1 and Length = -1. the bind function fails but now even the valid q uries which were running
fine wont run on the same DBPROCESS. I cannot call dbclose and then dbopen again bcuz of the reason mentioned above. Can anybody help me on this? And can anybody tell me why this happens and how can I avoid it? If I check for the values of length and max length while binding the parameter myself then can anybody provide me with the list that can cause the same problem?
Find Great Deals on Holiday Gifts at Yahoo! Shopping
More information about the FreeTDS