使用Spring和Apache DataSource的Teradata驱动程序的JDBC重新连接问题 [英] JDBC reconnect problems with Teradata driver using Spring and Apache DataSource

查看:123
本文介绍了使用Spring和Apache DataSource的Teradata驱动程序的JDBC重新连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Apache BasicDataSource用于公共DBCP和连接池:

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

如果我的数据库出现故障或出现网络故障,则与Teradata JDBC驱动程序结合使用时会收到以下错误:

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:我/ O错误,套接字已关闭。数据包流写入错误

08S01 804 : I/O Error, Socket closed. Packet stream write error

正确反映了这种情况,但问题在于重新连接。当错误被物理消除或DB重新启动并且我的程序尝试查询它时,我仍然会在一段时间内遇到相同的错误,例如, 20分钟,几个小时,再也没有。
重新启动JVM或更改连接字符串(例如使用IP地址代替主机名。

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.

数据源或Spring事务管理器中是否有任何设置可以解决此问题?

Is there any setting in the DataSource or the Spring Transaction Manager that can rectify this? or maybe a TCP/IP setting?

推荐答案

在Windows和Linux上都看到此错误吗?如果仅在Linux上看到它,那么我建议您查阅《 Teradata JDBC指南》。登录时,他们使用的算法在Linux版本的JVM上很慢。
尝试在服务命令的开头添加以下行,以查看是否有任何改善

Do you see this error on both Windows and Linux? If you only see it on Linux, then I recommend checking out the Teradata JDBC Guide. When logging on, they use an algorithm which is slow on the Linux version of the JVM. Try adding the following line to teh start of your service command to see if you get any improvement

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

注意:这取自故障排除部分Teradata JDBC驱动程序用户指南

Note: this was taken from the troubleshooting portion of the Teradata JDBC Driver User Guide

这篇关于使用Spring和Apache DataSource的Teradata驱动程序的JDBC重新连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆