数据库重新启动后将 jdbc 数据源重新连接到 sybase ASE 12.5
我有一个使用 jtds
驱动程序和 commons-dbcp
作为连接池的 java 应用程序。此应用程序连接到 Sybase ASE 12.5
。 sybase
有时会重新启动以进行维护。重新启动后,我的应用程序尝试重新连接到 sybase
,但它似乎总是失败,并出现以下异常:
java.sql.SQLException: Stored procedure 'dbo.pmxSystemDate' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output). at
net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at
net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820) at
net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258) at
net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632) at
net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477) at
net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1304)
这是数据源的 spring
配置:
<bean id="ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="url" value="jdbc:jtds:sybase://dbms:6000/dbTD" />
<property name="username" value="sa" />
<property name="password" value="" />
<property name="initialSize" value="5"/>
<property name="maxActive" value="10"/>
<property name="validationQuery" value="SELECT 1" />
<property name="testOnBorrow" value="true" />
<property name="maxWait" value="10" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="10" />
<property name="validationQueryTimeout" value="3" />
</bean>
如果我尝试模拟通过禁用然后启用网络接口来解决网络故障,一切都按预期工作,并且我的应用程序成功重新连接。
我也尝试过 jconnect
sybase
驱动程序,但没有成功。
我知道我可以通过指定完全限定的对象名称来解决此问题,但在这种情况下,我将对源进行大量编辑,因此我正在寻找更简单的解决方案。
有人遇到过这样的问题吗?
I have a java application that uses jtds
driver and commons-dbcp
as a connection pool. This application connects to the Sybase ASE 12.5
. From time to time sybase
is restarted for the maintenance. After restart my application tries to reconnect to sybase
, but it seems to fail all the time with the following exception:
java.sql.SQLException: Stored procedure 'dbo.pmxSystemDate' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output). at
net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at
net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820) at
net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258) at
net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632) at
net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477) at
net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1304)
Here is spring
configuration of the datasource:
<bean id="ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="url" value="jdbc:jtds:sybase://dbms:6000/dbTD" />
<property name="username" value="sa" />
<property name="password" value="" />
<property name="initialSize" value="5"/>
<property name="maxActive" value="10"/>
<property name="validationQuery" value="SELECT 1" />
<property name="testOnBorrow" value="true" />
<property name="maxWait" value="10" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="10" />
<property name="validationQueryTimeout" value="3" />
</bean>
If I try to emulate the network failure by disabling and then enabling the network interface everything works as expected and my app reconnects successfully.
I have also tried jconnect
sybase
driver but without success.
I understand that I can workaround this issue by means of specifying fully-qualified object names, but in that case I will have a lot of editing of my sources, so I'm looking for the simpler solution.
Have anyone faced with such an issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,为了解决这个问题,我必须将验证查询从更改
为
Well, to overcome this issue I had to change validation query from
to