May 12th, 2008, 08:22 AM
Connection-related Exceptions Handling
This question had been already discussed, but I couldn't find a solution that would completely suit me. Also, I'm not very good at Spring, so I apologize in advance if I'll say something really stupid.
While working with database connections, my application sometimes meets exceptions like EOFException, SocketException, etc. Those are related to timeouts and dropped connections, I assume.
I use JndiObjectFactoryBean as DataSource.
I do know about "select 1" solution, but it won't suit me due to added overhead.
I also still hadn't looked at c3p0 yet, but I was thinking if there's a way to intercept connection-related exceptions somewhere around DataSourceTransactionManager.
Would someone please tell me, what's the best place to handle such exceptions, and how can I configure Spring to use my class instead of default, say, TransactionManager.