t8y2/dbx · error · SQLException

Informix connection failed.\nURL: " + url.replaceAll("//[^@]

Error message

Informix connection failed.\nURL: " + url.replaceAll("//[^@]+@", "//***@") + "\nError: " + error.getMessage()

What it means

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.

Source

Thrown at agents/drivers/informix/src/main/java/com/dbx/agent/informix/InformixAgent.java:156

            int value = Math.abs(part);
            if (value > 0) {
                result.add(value);
            }
        }
        return result;
    }

    public static String databaseCatalogSql() {
        return "SELECT name FROM sysmaster:sysdatabases ORDER BY name";
    }

    @Override
    protected Connection openConnection(ConnectParams params) throws SQLException {
        String url = jdbcUrl(params);
        try {
            return DriverManager.getConnection(url, params.getUsername(), params.getPassword());
        } catch (SQLException error) {
            throw new SQLException(
                "Informix connection failed.\nURL: " + url.replaceAll("//[^@]+@", "//***@") + "\nError: " + error.getMessage(),
                error.getSQLState(), error.getErrorCode()
            );
        }
    }

    @Override
    public List<DatabaseInfo> listDatabases() {
        return unchecked(() -> {
            List<DatabaseInfo> result = new ArrayList<>();
            try (java.sql.Statement stmt = requireConnected().createStatement();
                 ResultSet rs = stmt.executeQuery(databaseCatalogSql())) {
                while (rs.next()) {
                    result.add(new DatabaseInfo(rs.getString(1).trim()));
                }
            }
            return result;
        });

View on GitHub (pinned to c0390bff16)

Solutions

  1. Check the underlying Error: message and SQLState in the exception to identify the root cause
  2. Verify the Informix server is running and reachable (telnet/nc to host:port, onstat on the server)
  3. Confirm the JDBC URL host, port, server (INFORMIXSERVER), and database name; recheck username/password

Example fix

// before
url = "jdbc:informix-sqli://wronghost:9088/stores:INFORMIXSERVER=ol_myhost";
// after
url = "jdbc:informix-sqli://dbhost:9088/stores:INFORMIXSERVER=ol_myhost";
Defensive patterns

Strategy: try-catch

Validate before calling

try (Socket s = new Socket()) { s.connect(new InetSocketAddress(host, port), 3000); } // pre-check reachability

Try / catch

try {
    Connection c = agent.connect(params);
} catch (SQLException e) {
    // e.getMessage() has masked URL + root cause; check SQLState/vendor code
    logger.error("Informix connect failed: state={} code={} msg={}", e.getSQLState(), e.getErrorCode(), e.getMessage());
}

Prevention

When it happens

Trigger: Any SQLException from DriverManager.getConnection: Informix server unreachable, wrong host/port in the URL, bad credentials, database not open, listener (dr_soctcp) down.

Common situations: Informix instance stopped; firewall blocking the port; wrong server name/port in JDBC URL; password expired or user locked; INFORMIXSERVER mismatch.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/8b0339ea8878dfb9. Report an issue: GitHub.