MuleSoft · Database Connector
DB:BAD_SQL_SYNTAX
Short answer
DB:BAD_SQL_SYNTAX means the SQL query you gave Database Connector contains invalid syntax. Correct the statement for your database, and check any part of it that is built dynamically.
VerifiedLast verified
01Error text
Error type: DB:BAD_SQL_SYNTAX02Likely causes
- The provided SQL query contains invalid syntax.
- On Snowflake, a callable statement written with curly brackets fails with
net.snowflake.client.jdbc.SnowflakeSQLException: Unsupported feature 'call'.
03How to fix it
- Read the SQL text of the failing operation and correct the syntax for the database you are connected to.
- For Snowflake stored procedures, write the statement without curly brackets, for example
call doubleMyInt(:myInt). - Turn on verbose logging to see the statement that was sent: add
AsyncLoggerentries atDEBUGfororg.mule.extension.dbandorg.mule.db.commonsinlog4j2.xml. Turn it off afterward. - Handle the failure with an error handler of type
DB:BAD_SQL_SYNTAXif the SQL is built from input you do not control.
04Official documentation
→Related errors
- DB:QUERY_EXECUTIONDB:QUERY_EXECUTION means the database accepted the connection but the execution of the query failed. Turn on verbose logging for Database Connector to see the database's own message, then fix the query, its parameters or its timeout.
- DB:CONNECTIVITYDB:CONNECTIVITY covers several possible connection problems in Database Connector, including a poorly configured connection, no response from the database and a lost connection. Check the connection configuration first, then add a reconnection strategy.
Test every fix in a non-production environment before you apply it to production. See how entries are verified.
More for MuleSoft work:Open MuleSoft jobsMuleSoft rates and salariesHire a senior MuleSoft developer