Archive for February, 2011
MySQL managed connections in tcServer
Posted by Lieven Doclo in General programming on 2011/02/02
MySQL connections configured as JNDI resources always have been a pain in the ass on Tomcat. Mostly because of the fact that the MySQL driver can’t handle connection failures correctly (keep a connection idle longer than the socket timeout on your MySQL server and you’ll see what I mean).
Recently, I’ve been hunting down a bug on our company’s JIRA server: invalid database connections were still held in the connection pool. So I consulted the JIRA documentation and they had a specific section regarding this problem. So I applied the instructions and restarted the server. It worked once again. But not for long: the day after, I was confronted with the same problem. So back to the drawing board.
I started thinking once again. The instructions for the solution were meant for Tomcat 6+. tcServer is just a glorified version of Tomcat, sprinkled with some SpringSource sugar. Perhaps SpringSource did something to the connection pooling? They did. They replaced the standard DBCP pooling with a high-performance concurrent connection pool… with extra parameters. Instructions can be found here. So lesson learned: never assume.