Lucas Licursi
Lucas Licursi

Reputation: 40

Routine (get_data_type) can not be resolved

I've just updated the informix jdbc driver on my application (from 3.0 to V4.10.JC4DE) and the following error occurred, when trying to connect with informix 9.

java.sql.SQLException: Routine (get_data_type) can not be resolved.
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3130)
    at com.informix.jdbc.IfxSqli.D(IfxSqli.java:3412)
    at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2325)
    at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2250)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1485)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1465)
    at com.informix.jdbc.IfxResultSet.a(IfxResultSet.java:211)
    at com.informix.jdbc.IfxStatement.executeQueryImpl(IfxStatement.java:1064)
    at com.informix.jdbc.IfxStatement.executeQuery(IfxStatement.java:236)
    at com.informix.jdbc.IfxDatabaseMetaData.getColumns(IfxDatabaseMetaData.java:3549)
    at com.mchange.v2.c3p0.impl.NewProxyDatabaseMetaData.getColumns(NewProxyDatabaseMetaData.java:3968)
    at org.hibernate.tool.hbm2ddl.TableMetadata.initColumns(TableMetadata.java:197)
    at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata.java:58)
    at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:113)
    ... 54 more

The new driver works fine with Informix 11. Unfortunately, I have to support connection with Informix 9.

Upvotes: 0

Views: 3172

Answers (2)

Devin Li
Devin Li

Reputation: 1

I came across this issue when trying to make the procedure call return an Object for testing

Instead, create a projection interface for the output and have the function return that.

Jpa interface projection: https://www.baeldung.com/spring-data-jpa-projections#1-closed-projections

Doesn't work:

public interface AnyInterface extends JpaRepository<Entity,Pk> {
  @Procedure("procedure_name")
  Object doProcedure(@Param("param1") String name);
}

Worked:

public interface AnyInterface extends JpaRepository<Entity,Pk> {
  @Procedure("procedure_name")
  ProjectionOutput doProcedure(@Param("param1") String name);
}

and in the controller, annotate the function calling repo.doProcedure(string) with @Transactional(readOnly = true) from org.springframework.transaction.annotation to deal with this error:

You're trying to execute a @Procedure method without a surrounding transaction that keeps the connection open so that the ResultSet can actually be consumed. Make sure the consumer code uses @Transactional or any other way of declaring a (read-only) transaction.

Upvotes: 0

Alexandre Marini
Alexandre Marini

Reputation: 230

Unfortunately, Informix 9 is a very very old engine. I think you should upgrade (or tell your clients to upgrade) to a newer - and supported - version. A simple upgrade should give them lots of new features, better performance (at least 40% more), and of course, a more stable engine.

Actually it really does not support version 9. On the product Release Notes page, you will see that:

"To use IBM Informix JDBC Driver to connect to an IBM Informix database, you must use one of the following IBM Informix database servers:

Version 11.50, 11.70, or 12.10
IBM Informix Extended Parallel Server, Version 8.3 or later

"

Upvotes: 1

Related Questions