Feeds:
Posts
Comments

Archive for June, 2009

Recently I was working on a small console application with a few threads that concurrently updated the database. I had to make things transactional and separated so each thread had to have it’s own connection.
ThreadLocal to the rescue:

package electro.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
* Thread local database connection.
* Main thread is expected to call init [...]

Read Full Post »