JDBC Reconnects Teradata Driver Issues with Spring and Apache DataSource

I use Apache BasicDataSource for both the DBCP database and the connection pool:

org.apache.commons.dbcp.BasicDataSource 

and controlling it through Spring:

 org.springframework.jdbc.datasource.DataSourceTransactionManager 

When using this combination with the Teradata JDBC driver, if my database goes down or a network failure occurs, I get the following error:

08S01 804: I / O error, closing the socket. Error writing packet stream

This correctly reflects the situation, but the problem is reconnecting. When the error is physically smoothed out or the DB returns and my program tries to request it, I still get the same error for some period of time that changes, for example. 20 minutes, hours, never. The problem goes away when I restart the JVM or change the connection string, for example. use an IP address instead of a host name.

Is there any parameter in the DataSource or Spring Transaction Manager that can fix this? or maybe TCP / IP settings?

+1
source share
2 answers

I would look at the settings on Apache DBCP:

http://commons.apache.org/dbcp/configuration.html

SELECT 1 can be an effective validation query. A return test must be installed.

I also ask that you delete and log abandoned connections so that you can see what is happening.

+1
source

Do you see this error for both Windows and Linux? If you only see this on Linux, I recommend checking out the Teradata JDBC manual. When they log in, they use the slow algorithm in the Linux JVM version. Try adding the following line to the top of your service team to see if you get any improvements.

 -Djava.security.edg=file:/dev/./urandom 

Note: this was taken from the troubleshooting section in the Teradata JDBC driver user guide

+1
source

Source: https://habr.com/ru/post/1400889/


All Articles