Multi-threaded applicattion exception

By: Ben Matterson

Abstract: Multi-threaded applications need one connection per thread.

PROBLEM

A multi-threaded InterBase application is throwing this exception:

Unable to complete network request to host "goofy".
Error writing data to the connection.
An established connection was aborted by the software in your host machine.


All access to the database takes place in "critical sections", so only one thread can access the data at one time. Sometimes the application runs fine for thousands of transactions, and then it raises the exception. What's going on?

SOLUTION

InterBase's client software is not thread safe. Each thread must have its own connection and the connection must be remote (the connection string must specify the server's name or IP address), even if the multi-threaded applicatiuon runs on the same machine as the InterBase server.

Note: This applies to InterBase versions prior to 7.x.

Server Response from: ETNASC03