{"record":{"id":"8b0339ea8878dfb9","repo":"t8y2/dbx","slug":"informix-connection-failed-nurl-url-replacea","errorCode":null,"errorMessage":"Informix connection failed.\\nURL: \" + url.replaceAll(\"//[^@]+@\", \"//***@\") + \"\\nError: \" + error.getMessage()","messagePattern":"Informix connection failed\\.\\\\nURL: \" \\+ url\\.replaceAll\\(\"//\\[\\^@\\]\\+@\", \"//\\*\\*\\*@\"\\) \\+ \"\\\\nError: \" \\+ error\\.getMessage\\(\\)","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"agents/drivers/informix/src/main/java/com/dbx/agent/informix/InformixAgent.java","lineNumber":156,"sourceCode":"            int value = Math.abs(part);\n            if (value > 0) {\n                result.add(value);\n            }\n        }\n        return result;\n    }\n\n    public static String databaseCatalogSql() {\n        return \"SELECT name FROM sysmaster:sysdatabases ORDER BY name\";\n    }\n\n    @Override\n    protected Connection openConnection(ConnectParams params) throws SQLException {\n        String url = jdbcUrl(params);\n        try {\n            return DriverManager.getConnection(url, params.getUsername(), params.getPassword());\n        } catch (SQLException error) {\n            throw new SQLException(\n                \"Informix connection failed.\\nURL: \" + url.replaceAll(\"//[^@]+@\", \"//***@\") + \"\\nError: \" + error.getMessage(),\n                error.getSQLState(), error.getErrorCode()\n            );\n        }\n    }\n\n    @Override\n    public List<DatabaseInfo> listDatabases() {\n        return unchecked(() -> {\n            List<DatabaseInfo> result = new ArrayList<>();\n            try (java.sql.Statement stmt = requireConnected().createStatement();\n                 ResultSet rs = stmt.executeQuery(databaseCatalogSql())) {\n                while (rs.next()) {\n                    result.add(new DatabaseInfo(rs.getString(1).trim()));\n                }\n            }\n            return result;\n        });","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/informix/src/main/java/com/dbx/agent/informix/InformixAgent.java#L138-L174","documentation":"InformixAgent.openConnection wraps DriverManager.getConnection failures in a SQLException carrying a readable summary: the JDBC URL (with credentials in the URL masked via the //[^@]+@ regex) plus the underlying error message, preserving SQLState and vendor error code.","triggerScenarios":"Any SQLException from DriverManager.getConnection: Informix server unreachable, wrong host/port in the URL, bad credentials, database not open, listener (dr_soctcp) down.","commonSituations":"Informix instance stopped; firewall blocking the port; wrong server name/port in JDBC URL; password expired or user locked; INFORMIXSERVER mismatch.","solutions":["Check the underlying Error: message and SQLState in the exception to identify the root cause","Verify the Informix server is running and reachable (telnet/nc to host:port, onstat on the server)","Confirm the JDBC URL host, port, server (INFORMIXSERVER), and database name; recheck username/password"],"exampleFix":"// before\nurl = \"jdbc:informix-sqli://wronghost:9088/stores:INFORMIXSERVER=ol_myhost\";\n// after\nurl = \"jdbc:informix-sqli://dbhost:9088/stores:INFORMIXSERVER=ol_myhost\";","handlingStrategy":"try-catch","validationCode":"try (Socket s = new Socket()) { s.connect(new InetSocketAddress(host, port), 3000); } // pre-check reachability","typeGuard":null,"tryCatchPattern":"try {\n    Connection c = agent.connect(params);\n} catch (SQLException e) {\n    // e.getMessage() has masked URL + root cause; check SQLState/vendor code\n    logger.error(\"Informix connect failed: state={} code={} msg={}\", e.getSQLState(), e.getErrorCode(), e.getMessage());\n}","preventionTips":["Health-check the Informix host:port before connecting","Keep credentials out of the URL where possible (use properties) to avoid masking ambiguity","Rotate/verify credentials and INFORMIXSERVER settings after server moves"],"tags":["informix","jdbc","connection","sql"],"backgroundTag":"connection-refused","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}