{"record":{"id":"f0fd637f6ed756bf","repo":"louislam/uptime-kuma","slug":"database-connection-query-failed-error-message-f0fd63","errorCode":null,"errorMessage":"Database connection/query failed: ${error.message}","messagePattern":"Database connection/query failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/monitor-types/oracledb.js","lineNumber":63,"sourceCode":"                heartbeat.status = UP;\n                heartbeat.msg = \"Query did meet specified conditions\";\n            } else {\n                const result = await this.oracledbQuery(\n                    monitor.databaseConnectionString,\n                    query,\n                    monitor.basic_auth_user,\n                    monitor.basic_auth_pass\n                );\n                heartbeat.ping = dayjs().valueOf() - startTime;\n                heartbeat.status = UP;\n                heartbeat.msg = result;\n            }\n        } catch (error) {\n            heartbeat.ping = dayjs().valueOf() - startTime;\n            if (error.message.includes(\"did not meet the specified conditions\")) {\n                throw error;\n            }\n            throw new Error(`Database connection/query failed: ${error.message}`);\n        }\n    }\n\n    /**\n     * Run a query on Oracle Database.\n     * @param {string} connectionString The Oracle DB connection string\n     * @param {string} query The query to execute\n     * @param {string} username Oracle DB username\n     * @param {string} password Oracle DB password\n     * @returns {Promise<string>} Row count or execution message\n     */\n    async oracledbQuery(connectionString, query, username, password) {\n        let connection;\n        try {\n            connection = await oracledb.getConnection({\n                connectString: connectionString.trim(),\n                user: username.trim(),\n                password: password.trim(),","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/oracledb.js#L45-L81","documentation":"Catch-all wrapper in OracledbMonitorType.check: any error whose message does NOT contain 'did not meet the specified conditions' is re-thrown as 'Database connection/query failed: <original>'. This wraps oracledb getConnection/connectivity errors, ORA- errors, TNS errors, and credential failures.","triggerScenarios":"oracledb.getConnection({connectString,user,password}) rejects (ORA-12154 TNS, ORA-12541 no listener, ORA-01017 invalid credentials, DPI-1080), connection.execute rejects (ORA-00942 table not found, ORA-00936 syntax), or the single-value validation errors fire. The substring guard forwards condition-mismatch messages unchanged.","commonSituations":"connectString format wrong for the installed mode (Thin vs Thick); tnsnames.ora missing/misconfigured; Oracle Instant Client not installed for Thick mode; wallet/TLS not configured for cloud Autonomous DB; wrong schema so objects are not visible; listener port 1521 blocked.","solutions":["Connect with sqlplus / SQLcl from the Uptime Kuma host using the identical connect string.","For Thick mode, install Oracle Instant Client and set LD_LIBRARY_PATH; for Thin mode, ensure the connectString uses the host:port/service form.","Verify wallet/TLS for Autonomous Database (connect_string points at tnsnames alias with tls config).","Confirm the user can SELECT the target object (grant privileges, correct schema prefix).","Check listener reachability on port 1521/1522 and firewall rules."],"exampleFix":"// before: connectString='ORCL'   (Thick mode, no Instant Client -> DPI-1047)\n// after (Thin mode, no client needed):\nconnectString='10.0.0.5:1521/ORCLPDB1'","handlingStrategy":"retry","validationCode":"function portOpen(host, port, ms=2000) { /* same TCP probe as MSSQL */ }\n// Parse connectString host:port/service and probe 1521/1522 before relying on the monitor.","typeGuard":null,"tryCatchPattern":"async function withRetry(fn, retries=3, base=1000) {\n  for (let i=0;i<=retries;i++){ try { return await fn(); } catch(e){\n    if (/Database connection\\/query failed/.test(e.message) && i<retries) await sleep(base*2**i); else throw e; } }\n}","preventionTips":["Test the connect string with sqlplus/SQLcl from the Kuma host.","Install Instant Client for Thick mode or use Thin host:port/service form.","Configure wallet/TLS for Autonomous Database; verify listener port reachability.","Wrap transient errors with bounded retry; alert on repeated failures."],"tags":["oracle","oracledb","database","connection","uptime-kuma"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}