Sound have checked JIRA[1] before posting. Turns out the example[2] works fine with Derby instead of HSQL. Thanks! --Matt Payne
[1] https://issues.apache.org/jira/browse/CAMEL-7251?jql=issuetype%20%3D%20Bug%20AND%20text%20~%20%22SqlProducer%22 [2] https://github.com/payne/CamelSqlDemo/tree/master/SqlRouteTestDemo On Thu, Mar 13, 2014 at 2:48 PM, Matt Payne <pa...@mattpayne.org> wrote: > Hi! I am trying to learn about the SQL component. I found an > example[7], SqlRouteTest, and have tried to apply some debugging[5], and > tracing[6] to it. Even with logging turned all the way up[8] I don't get > tracing output. Using the debugger I see the route that starts with > direct:simple being called. > > My question is why does the insert route[2] work and the select route[3] > fail? The debug output[8] shows that the setUp() method is inserting > several rows into the database. When I run SqlRouteTest. testSimpleBody > I get a stack trace[9] that I fail to see a clue in. > > Would you please give me any suggestions or tell me what I'm doing wrong > please? > > When I step through things using eclipse's debugger I see this in > org.apache.camel.component.sql.SqlProducer around line 91. The first call > to ps.getResultSet() returns non-null, the second call to ps.getResultSet() > returns null. > > if (isResultSet) { > > ResultSet rs = ps.getResultSet(); > > SqlOutputType outputType = > getEndpoint().getOutputType(); > > log.trace("Got result list from query: {}, > outputType={}", rs, outputType); > > if (outputType == SqlOutputType.SelectList) { > > List<Map<String, Object>> data = > getEndpoint().queryForList(ps.getResultSet()); > > > Thanks! --Matt Payne; cell: (402) 208 8787 > > [1] https://github.com/payne/CamelSqlDemo/tree/master/SqlRouteTestDemo > [2] > > from("direct:insert") > .to("sql:insert into projects values (#, #, #)") > .to("mock:result"); > > [3] > > from("direct:simple") > .tracing() > .to("sql:select * from projects where license = # order by id") > .tracing() > .to("mock:result"); > > [4] http://camel.apache.org/sql-component.html > [5] http://camel.apache.org/debugger.html > [6] http://camel.apache.org/tracer.html > [7] > https://svn.apache.org/repos/asf/camel/sandbox/tuning-experiment/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java > [8] > https://github.com/payne/CamelSqlDemo/blob/master/SqlRouteTestDemo/target/camel-sql-test.log > [9] > > Caused by: java.lang.NullPointerException > at > org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:91) > at > org.apache.camel.component.sql.SqlEndpoint.queryForList(SqlEndpoint.java:258) > at > org.apache.camel.component.sql.SqlProducer$1.doInPreparedStatement(SqlProducer.java:96) > at > org.apache.camel.component.sql.SqlProducer$1.doInPreparedStatement(SqlProducer.java:60) > at > org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589) > at > org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617) > at > org.apache.camel.component.sql.SqlProducer.process(SqlProducer.java:60) > at > org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110) > at > org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163) > at org.apache.camel.processor.interceptor.Debug$1.process(Debug.java:50) > at > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:118) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) > at > org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) > at > org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:73) > at > org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:378) > at > org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:346) > at > org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:242) > at > org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:346) > at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:184) > at > org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:124) > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:137) > ... 49 more > > > > -- --Matt Payne