# JDBC sequential URL and its usage with singlestore-jdbc-client-1.2.1.jar

**URL:** <https://www.singlestore.com/forum/t/jdbc-sequential-url-and-its-usage-with-singlestore-jdbc-client-1-2-1-jar/7665>\
**Category:** Connectors and Pipelines\
**Tags:** community, pipelines, developer\
**Created:** [May 2, 2024, 12:33pm UTC](https://www.singlestore.com/forum/t/jdbc-sequential-url-and-its-usage-with-singlestore-jdbc-client-1-2-1-jar/7665 "2024-05-02T12:33:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![muhammadosama.hassan](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@muhammadosama.hassan](https://www.singlestore.com/forum/u/muhammadosama.hassan)\
**Post date:** [May 2, 2024, 12:33pm UTC](https://www.singlestore.com/forum/t/jdbc-sequential-url-and-its-usage-with-singlestore-jdbc-client-1-2-1-jar/7665/1 "2024-05-02T12:33:05Z")

</div>

have any body used and give me an example of singlestore-jdbc-client-1.2.1.jar i want to enable a failover JDBC connection with my aggregator node as it will be promoted to Master incase of primary failure.

---

<div class="post-metadata">

**Author:** ![oyeliseiev-ua](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/oyeliseiev-ua/32/1954_2.png) [@oyeliseiev-ua](https://www.singlestore.com/forum/u/oyeliseiev-ua)\
**Post date:** [September 11, 2024, 9:50am UTC](https://www.singlestore.com/forum/t/jdbc-sequential-url-and-its-usage-with-singlestore-jdbc-client-1-2-1-jar/7665/2 "2024-09-11T09:50:54Z")

</div>

Hi,

An example of such a connection for simple cluster with 1 master and 1 leaf node could be the following:

master node: localhost:3306  
leaf node: localhost:3307

```auto
        var dbUrl = "jdbc:singlestore:sequential://localhost:3306,localhost:3307/db";
        var properties = new Properties();
        properties.put("user", "root");
        properties.put("password", "root");
        properties.put("retriesAllDown", "10");//number of retries when all hosts are down (default is 120)
        try (com.singlestore.jdbc.Connection conn = (com.singlestore.jdbc.Connection) DriverManager.getConnection(dbUrl, properties)) {
            MultiPrimaryClient client = (MultiPrimaryClient) conn.getClient();
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT 1");
            while (rs.next()) {
                System.out.println(rs.getString(1));
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

```

When the connector tries to connect, it will always try host1 first (master). If that host is not available, then it will try host2 (leaf node). There is no logging, but you can debug `MultiPrimaryClient#connectHost` to investigate the behavior.
