1. General Connection Settings

Connection Parameters

The connection details for your database are available in the Connect panel of the Relyt console. You can copy a ready-to-use connection string for common clients or copy individual parameters.
postgresql://relytdb_owner:[your_password_here]@relyt-t8e2q4l3we7w-pooler.us-ca.cs.data.cloud/relytdb?sslmode=require
            |               |                      |                   |                        |
            |               |                      |                   |                        +--> database name
            |               +-----> password       +------> hostname   |
            |                                                          |
            +-----> username                                           +--> "-pooler" suffix indicates server-side pooling
                                                   
Gui Console Pn

Connection Pooling

Every Relyt compute has server-side connection pooling enabled. To use it, connect to the hostname with the -pooler suffix.
  • Powered by PgBouncer
  • Supports up to 10,000 concurrent client connections
  • Configured with pool_mode=transaction (see feature details)
You can also keep client-side connection pools in your application; they complement the server-side pool to smooth spikes and reduce latency.

TLS/SSL Security

Relyt requires TLS for all connections. Connections that do not use SSL/TLS are rejected. The minimum acceptable setting is sslmode=require. For stronger protection against man-in-the-middle attacks, prefer sslmode=verify-ca or sslmode=verify-full. When using verify-ca or verify-full, ensure the appropriate CA root is available on the host or provide sslrootcert explicitly.
sslmodeVerification and Behavior
requireMinimum requiredTLS required; no CA/hostname verification
verify-caRecommendedTLS required; verifies CA; provide sslrootcert if needed
verify-fullRecommendedTLS required; verifies CA and hostname; provide sslrootcert if needed

2. PSQL Connection

psql is the official command-line client tool provided by PostgreSQL and is the most direct way to connect to Relyt.
psql 'postgres://[user]:[password]@[hostname]/[database]?sslmode=require'

3. Python Connection

Python is one of the most commonly used languages in data analysis and backend development. Through the psycopg2 driver, you can easily connect to and operate Relyt databases in Python applications. The following introduces two common connection methods: connection pooling and direct connection.

Install Dependencies

Before getting started, you need to install the PostgreSQL Python driver. psycopg2-binary is a pre-compiled binary version that is more convenient to install and suitable for most use cases.
pip install psycopg2-binary

Connection Pool Method

Connection pooling is the recommended connection method for production environments, especially suitable for high-concurrency web applications. Connection pooling can reuse database connections, avoiding performance overhead from frequently establishing and disconnecting connections, while also controlling the maximum number of connections to prevent too many database connections.
from psycopg2 import pool

connection_url = f"postgresql://[username]:[password]@[hostname]/[database]?sslmode=require"
connection_pool = pool.SimpleConnectionPool(1, 5, connection_url)

conn = connection_pool.getconn()
cur = conn.cursor()
cur.execute("SELECT version();")
result = cur.fetchone()
print("PostgreSQL version:", result[0])

cur.close()
connection_pool.putconn(conn)
connection_pool.closeall()

Direct Connection Method

The direct connection method is suitable for simple scripts and one-time operations. This approach has more intuitive code and is suitable for learning and debugging.
import psycopg2

conn = psycopg2.connect(
    host="[hostname]",
    port=5432,
    user="[user]",
    password="[password]",
    dbname="[database]",
    sslmode="require"
)

cur = conn.cursor()
cur.execute("SELECT version();")
result = cur.fetchone()
print("PostgreSQL version:", result[0])

cur.close()
conn.close()

4. Java Connection

Java is the mainstream language for enterprise application development. You can easily connect to Relyt databases through the PostgreSQL JDBC driver. JDBC (Java Database Connectivity) is Java’s standard database connection API, providing a unified database access interface.
Requirement: PostgreSQL jar package version must be at least 42.2.6

URL Parameter Method

This is the most common JDBC connection method, where all connection parameters are included in the connection URL. This method is suitable for applications with relatively fixed configurations.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

String url = "jdbc:postgresql://[host]:[port]/[database]?user=[username]&password=[password]&sslmode=require";
Connection conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT version();");

if (rs.next()) {
    System.out.println("PostgreSQL version: " + rs.getString(1));
}

rs.close();
stmt.close();
conn.close();

Properties Method

Using a Properties object to configure connection parameters provides greater flexibility, especially suitable for scenarios that require dynamic configuration of connection parameters, such as reading connection information from configuration files.
import java.util.Properties;

String url = "jdbc:postgresql://[host]:[port]/[database]";
Properties props = new Properties();
props.setProperty("user", "[username]");
props.setProperty("password", "[password]");
props.setProperty("sslmode", "require");

Connection conn = DriverManager.getConnection(url, props);

Configure Application Name

Setting a meaningful name for your application is a good practice that helps database administrators identify and monitor different client connections. Add the ApplicationName parameter to the connection string:
jdbc:postgresql://localhost:5435/MyDB?ApplicationName=MyApp
Note: After configuration, administrators can view which client a session belongs to through pg_stat_activity. This is very useful for troubleshooting and performance monitoring. Reference Documentation: https://jdbc.postgresql.org/documentation/use/

5. GUI Client Applications

For users who are not familiar with command-line operations, or for scenarios that require complex data browsing and management, graphical database management tools provide a more intuitive operating interface. These tools typically provide data table browsing, SQL query editors, data import/export, database structure management, and other functions. To connect to Relyt through GUI applications, you generally need to provide the following information:
  • hostname
  • port
  • username
  • password
  • database
Except for the password, all this information can be obtained from the Connect interface in the console.

pgAdmin4

pgAdmin is the officially recommended web interface management tool for PostgreSQL, which is powerful and completely free. It provides complete database management functions, including database object management, SQL query execution, performance monitoring, backup and recovery, etc. Pgadmin Gui Pn

DBeaver

DBeaver is a universal database management tool that supports multiple database types. It has a modern user interface and provides powerful SQL editors, data visualization tools, and a rich plugin ecosystem. For users who need to manage multiple types of databases, DBeaver is a great choice. Dbeaver Gui Pn

6. Common Issues

During usage, you may encounter some connection issues. The following are the most common problems and their solutions:

Endpoint ID is not specified

This error typically occurs when using older versions of PostgreSQL client libraries. The root cause of the problem is that the client’s TLS implementation does not support Server Name Indication (SNI) technology, while Relyt’s cloud service relies on SNI to correctly route connections to the corresponding database instances. When the client TLS does not support Server Name Indication (SNI), the connection may show the following error:
ERROR: Endpoint ID is not specified. Either please upgrade the postgres client library (libpq) for SNI support or pass the endpoint ID (first part of the domain name) as a parameter: ‘?options=project%3D’.
Solutions: Upgrade your PostgreSQL client: Install psql (libpq) >= 14 for full SNI support