MuleSoft · Database Connector
DB:CONNECTIVITY
DB: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.
VerifiedLast verified
01Error text
Error type: DB:CONNECTIVITY02Likely causes
- Any of several connectivity issues, including poorly configured connections, lack of a database response and loss of connection.
- Without a reconnection strategy, the default behavior is for the operation to fail immediately and return a connectivity error.
- On CloudHub with a static IP, the connectivity test at deployment can run before the static IP is assigned. The docs list the message
Could not obtain connection from data sourcefor this case.
03How to fix it
- Check the Database configuration: host, port, database name, user and password for the environment the app runs in.
- Add a reconnection strategy to the connection, for example
<reconnection><reconnect frequency="4000" count="5"/></reconnection>.frequencyis in milliseconds and defaults to 2000, andcountdefaults to 2. - If the flow hangs or fails under load, check the pooling profile. A pool with fewer connections than the flow needs is a documented cause, and raising
maxPoolSizeis the fix. - For the CloudHub static IP case, set the system property
-DdoTestConnectivity=false. - Turn on verbose logging: add
AsyncLoggerentries atDEBUGfororg.mule.extension.dbandorg.mule.db.commonsinlog4j2.xml. Turn it off afterward.
iNotes
Database Connector also has more specific types: DB:CANNOT_REACH (cannot establish a connection with the RDBMS), DB:INVALID_CREDENTIALS (the database rejects the credentials), DB:INVALID_DATABASE (the database does not exist) and DB:CANNOT_LOAD_DRIVER (the JDBC driver cannot be loaded).
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:BAD_SQL_SYNTAXDB: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.
- HTTP:CONNECTIVITYHTTP:CONNECTIVITY means the HTTP Request operation could not establish a connection to the server. Check the host, port, protocol and TLS settings, and add your own retry because the operation does not use the reconnection strategy for retries.
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