1

I have the following Camel route definition. Its purpose is to export some records in Informix to CSV.

<route id="out">
  <from uri="timer:foo?repeatCount=1" />
  <to uri="sql:select nro_service, enviado_sap ,estado_transmision from servicio_cab?dataSource=dataSource" />
  <to uri="bean:com.enelint.pangeaenelist.Transformer?method=tocsv(Exchange)" />
  <log message="${body}" />
</route>

I'm getting the following error from Informix:

Stacktrace

org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [select nro_servicio, enviado_sap ,estado_transmision from servicio_cab]; SQL state [IX000]; error code [-79782]; Method can be called only once.; nested exception is java.sql.SQLException: Method can be called only once.
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)

The inner exception is java.sql.SQLException: Method can be called only once. How can I fix this?

Roddy of the Frozen Peas
  • 14,380
  • 9
  • 49
  • 99
Fran S.
  • 29
  • 7
  • Why are you posting pictures of code? Just post the code! – Roddy of the Frozen Peas Nov 30 '17 at 18:05
  • I've transcribed your image into code and formatted your stack trace. I've also clarified your title to reflect what your problem actually is -- that there's a SQLException when executing the prepared statement in the route. I've removed all of the irrelevant tags as well. – Roddy of the Frozen Peas Nov 30 '17 at 18:09
  • I couldn't add the block of code, that's why I posted an image. Thanks for the formatting and clarification of my question. – Fran S. Nov 30 '17 at 18:33
  • You can always add code. What you can't do is add images because you don't have enough reputation on this site. Please read the page on [formatting](https://stackoverflow.com/help/formatting) for more information on how to format your code in your posts. – Roddy of the Frozen Peas Nov 30 '17 at 18:42
  • To be more precise about the error I've experiencing, I should say that the same Camel route worked fine when I connected it to a Postgres DB. The problem seems to appear when connecting to Informix. It seems that the driver had some bug but it's supposed to be fixed by now. I think that people found some kind of workaround for this problem. – Fran S. Nov 30 '17 at 18:58
  • IBM reported this bug: https://www.ibm.com/support/knowledgecenter/en/SSGU8G_12.1.0/com.ibm.jdbc_pg.doc/ids_jdbc_406.htm Apparently, the offending methods getUpdateCount() and getResultSet() are called more than once in the line – Fran S. Nov 30 '17 at 20:00
  • You could, possibly, write your own component in Camel and use your own classes instead of the built-in. That is, [find](https://github.com/apache/camel/blob/master/components/camel-sql/src/main/java/org/apache/camel/component/sql/) the offending implementation and write your own fix. Or look to see if there's a bug filed either with camel or spring-camel and see if they offer a solution. – Roddy of the Frozen Peas Nov 30 '17 at 20:49
  • Hello Roddy, here is a detailed discussion about the issue involving getResultSet(): https://stackoverflow.com/questions/9984468/getresultset-should-be-called-only-once-per-result If you know some workaround for this issue I'll appreciate your help.Thanks – Fran S. Dec 01 '17 at 12:46

1 Answers1

1

The reported issue in camel 2.12 was fixed; updating to Camel version 2.20.1 did the trick. Thanks for your help.

Fran S.
  • 29
  • 7