[freetds] Querying from multiple threads - SEGMENTATION FAULT

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Thu Jan 5 05:17:52 EST 2006


> 
>  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 ru
>  nning
>  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?
> 

Hi, 
  sorry for late reply. You should try snapshot version as it fixes
problem like this.

freddy77


More information about the FreeTDS mailing list