Question

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?

Was it helpful?

Solution

Well, to overcome this issue I had to change validation query from

select 1

to

select name from dbTD..sysobjects where name='sysobjects'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top