Sunday, September 21, 2014

Mule: No SQL Strategy found Issue in SQL Server


Problem

I was working on a Mule ESB process, when I came upon an error.

Root Exception stack trace:
java.lang.IllegalArgumentException: No SQL Strategy found for SQL statement: USE XXX_ServiceNow; SELECT LastEventId,LastEventTime FROM dbo.EVENTS_TRACKING;
at com.mulesoft.mule.transport.jdbc.sqlstrategy.EESqlStatementStrategyFactory.create(EESqlStatementStrategyFactory.java:109)
at org.mule.transport.jdbc.JdbcMessageDispatcher.doSend(JdbcMessageDispatcher.java:69)
at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:81)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)


I will admit this was one of the first times I had worked with SQL Server. I typically use everything except it, but I digress. I was attempting a simple query from a table, but getting back "No SQL Strategy..."

Solution

I had seen this error before, and what it means is that there essentially no SQL plan to be executed. In the original state. I was technically performing two operations.
1. Specifying which database to use.
2. Querying the table.
To solve my problem I needed to combine these two statements into a single statement.

The resulting code looked something like this:
SELECT <FieldName1>, <FieldName2>
FROM <DatabaseName>.<SchemaName>.<TableName>


2 comments:

rajesh said...

Thank you for providing useful information and its best for the students to make good career.learn sap-fico training course.
sap-fico

Villas in Rajahmundry said...

Thank you for providing useful information and its best for the students to make good career

Villas in Rajahmundry

Flats in Rajahmundry