I'm using the Apache BasicDataSource for both commons DBCP and connection pool:
org.apache.commons.dbcp.BasicDataSource
and managing it through Spring:
org.springframework.jdbc.datasource.DataSourceTransactionManager
While using this combination with the Teradata JDBC driver if my database goes down or there is a network glitch I receive the following error:
08S01 804 : I/O Error, Socket closed. Packet stream write error
Which reflects the situation correctly but the problem is with reconnecting. When the error is ironed out physically or DB comes back up and my program tries to query it, I still end up getting the same error for some time period which varies e.g. 20 minutes, hours, never. The problem goes away when either I restart my JVM or change the connection string e.g. use IP address instead of hostname.
Is there any setting in the DataSource or the Spring Transaction Manager that can rectify this? or maybe a TCP/IP setting?