Occasionally, I'm running into the following exception, and it is starting
to be a pain...

SQLException: Unable to connect to any hosts due to exception:
java.net.BindException: Address already in use: connect
Exception in thread "Thread-6" java.lang.NullPointerException

I'm running two Java programs which access my database at the same time.
One program is queuing a lot of data. The other program occasionally (every
10sec unless triggered by the user) polls the database to get a list of the
data.

The queuer starts a thread to handle all the queuing. Typically, it gets
about 400 queued when the collision occurs. The queuer never requests a
list of all points, it just adds them, so its queries are relatively quick.

The poller is requesting a full list of data, so those requests are much
slower. I can limit how frequently a complete update is performed, but it
must be done occasionally. I'm afraid that a heuristic may just mask the
bug, making it harder to reproduce.

If I run the queuer alone (no competing poller), it runs great. In fact,
last night I ran two concurrent threads each queuing 10000 entries. The job
completed without any problem.

I'm running MySQL 4.0.18-nt on Windows 2000 Pro. The database and the
application are running on the same machine. I'm using
mysql-connector-java-3.0.11-stable-bin as my JDBC driver.

Thanks in advance for any pointers,

Rob