The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

OrBee (61) [Avatar] Offline
It seems that the improved case does not work for my test case. The following configuration although similar to yours, doesn't work. The table is created but the search for first row fails because it says the table doesn't exist. I see this stack trace:
name='endpoint.jdbc.selectFirstProcess', mep=ONE_WAY, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false} (timeout=60000)
at org.mule.transport.AbstractMessageRequester.request(
at org.mule.transport.AbstractConnector.request(
at org.mule.endpoint.DefaultInboundEndpoint.request(
at org.mule.client.DefaultLocalMuleClient.request(
... 14 more
Caused by: org.h2.jdbc.JdbcSQLException: Table "PROCESSTABLE" not found; SQL statement:
select TOP 1 data from processTable [42102-174]

processId int IDENTITY(1,1) NOT NULL,
psId, varchar(100) NULL,
limitStatusId, varchar(100) NULL,
processStatus varchar(15) NULL,
secondaryProcessStartTimeId varchar(100) NULL,
processFullName varchar(smilie NULL,

<spring-jdbc:embedded-database id="jdbcDataSource" type="H2">
<spring-jdbc:script location="classpath:db/processDB.sql" />


<http:endpoint name="httpInboundEndpoint" >
exchange-pattern="request-response" />

<flow name="jdbcFunctionalTestComponentFlow">
<inbound-endpoint ref="httpInboundEndpoint" />
<object-to-string-transformer />

and acme-bridge.xml

<jdbc:connector name="pdDatabaseConnector" dataSource-ref="jdbcDataSource" >
<jdbc:query key="insertProcess" value="insert into processTable <br /> ( <br /> psId, <br /> limitStatusId, <br /> processStatus, <br /> secondaryProcessStartTimeId, <br /> processFullName <br /> ) <br /> VALUES(null,"data1","xPass","gloabdPs"smilie" >

<jdbc:query key="selectFirstProcess" value="select TOP 1 data from processTable"></jdbc:query>


<flow name="IcisCustomerInsertion">
<vm:inbound-endpoint path="" />
<jdbc:outbound-endpoint queryKey="insertProcess" />
<http:outbound-endpoint ref="httpInboundEndpoint" />

Is there another way to test the jdbc component other than the method in the book, that doesn't work except for the simple case in the book.
David Dossot (233) [Avatar] Offline
Re: AcmeApiBridgeImprovedTestCase: Is there another technic that works?
Sorry but the example in the book also works for non-simple examples.

Your problem comes from the fact that the table doesn't exist: have you investigated why?
OrBee (61) [Avatar] Offline
Re: AcmeApiBridgeImprovedTestCase: Is there another technic that works?
The table gets created but seems to be dropped before the select finishes executing. The debug information earlier in the log information shows the datasource connected and the table created.
David Dossot (233) [Avatar] Offline
Re: AcmeApiBridgeImprovedTestCase: Is there another technic that works?
OK, do you have the possibility to provide a Maven project with the failing test case, Mule config, etc... just what's needed to reproduce the issue. Based on that, we'll be able to make suggestions on how the book example is applicable (or not) and can be adapted (or not) to your use case.
OrBee (61) [Avatar] Offline
Re: AcmeApiBridgeImprovedTestCase: Is there another technic that works?
Thanks I do. But I have found the reason for the problem. The H2 database documentation mentions the following for IN-Memory databases:

In some cases, only one connection to a in-memory database is required. This means the database to be opened is private. In this case, the database URL is jdbc:h2:mem: Opening two connections within the same virtual machine means opening two different (private) databases.

So the first connection being in a transaction writes and commits the data but then subsequently closes the connection. The second connection used for the select statement does not see the database and complains database is not found.