Connect and query an instance¶
CloudSigma OmniFabric database instances use the MySQL protocol. After creating a database instance, configure its network policy and TLS settings, connect with a MySQL-compatible client or driver, and run SELECT 1 to verify connectivity.
Before you begin¶
Create a database instance and wait until its status becomes Available. See Database Instance.
Open the instance’s connection action in the console and copy the host, port, user name, and sample connection command.
Confirm your administrator password (
admin) or theusername:role_namecredential created for your account. See OmniFabric permissions.
Configure IP allowlist and TLS¶
Before connecting from an external client or application:
IP allowlist (Network Policy):
Open the instance’s Network Policy settings.
For production workloads, choose Access from a specified IP address and add the public egress IP address or CIDR block of your client host or application server.
Use Access from anywhere only for temporary testing, and restrict the allowlist once testing is complete.
TLS encryption:
Use the TLS parameters shown in the console’s connection command (for example,
--ssl-mode=REQUIREDfor the MySQL CLI,ssloptions in Python, orsslMode=REQUIREDin JDBC).If the console provides a CA certificate bundle for your region, download it and pass it to your client’s CA option to verify the server certificate.
Connect with the MySQL client¶
Replace the placeholders with the host, port, and user name copied from the console:
mysql \
-h <host> \
-P <port> \
-u admin \
-p \
--ssl-mode=REQUIRED
Enter the password when prompted. To connect as a regular database user with an explicit role, pass -u <username>:<role_name>.
Verify with SELECT 1¶
After signing in, run a quick connectivity and catalog check:
SELECT 1;
SHOW DATABASES;
If SELECT 1; returns 1, the network path, TLS handshake, and authentication succeeded.
Connect with Python¶
Install PyMySQL (or another MySQL-compatible driver):
pip install pymysql
Store connection values in environment variables and run a SELECT 1 check:
import os
import pymysql
conn = pymysql.connect(
host=os.environ["OMNIFABRIC_HOST"],
port=int(os.environ.get("OMNIFABRIC_PORT", "6001")),
user=os.environ["OMNIFABRIC_USER"],
password=os.environ["OMNIFABRIC_PASSWORD"],
ssl={"ssl": {}},
connect_timeout=10,
)
try:
with conn.cursor() as cursor:
cursor.execute("SELECT 1")
print(cursor.fetchone())
finally:
conn.close()
Expected output:
(1,)
If your deployment requires CA certificate verification, pass ssl={"ca": "/path/to/ca.pem"} instead of ssl={"ssl": {}}.
Connect with Java (JDBC)¶
Add the MySQL Connector/J dependency to your project (Maven example):
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.4.0</version>
</dependency>
Connect using JDBC with TLS enabled and execute SELECT 1:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class OmniFabricConnectExample {
public static void main(String[] args) throws Exception {
String host = System.getenv("OMNIFABRIC_HOST");
String port = System.getenv().getOrDefault("OMNIFABRIC_PORT", "6001");
String user = System.getenv("OMNIFABRIC_USER");
String password = System.getenv("OMNIFABRIC_PASSWORD");
String url = String.format(
"jdbc:mysql://%s:%s/?sslMode=REQUIRED&useUnicode=true&characterEncoding=utf8",
host, port
);
try (Connection conn = DriverManager.getConnection(url, user, password);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT 1")) {
if (rs.next()) {
System.out.println("Result: " + rs.getInt(1));
}
}
}
}
Expected output:
Result: 1
Troubleshoot common connection errors¶
Symptom or error |
Likely cause |
What to do |
|---|---|---|
Connection timed out ( |
Client public IP is not in the instance IP allowlist, host/port is wrong, or outbound port is blocked by a local firewall |
Confirm the instance status is Available, verify host and port from the console, add your client’s current egress IP under Network Policy, and check outbound firewall rules |
TLS / SSL handshake error ( |
Client TLS mode does not match the instance requirement or CA file path is invalid |
Match the TLS flags shown in the console connection command ( |
Authentication failed ( |
Incorrect password, wrong user name, or missing role suffix for a regular user |
Confirm the password for |
Insufficient privileges on database or table ( |
Active role does not have the required |
Run |
Connection rejected or instance unavailable |
Instance is still creating, restricted due to quota/Credit limits, or stopped |
Check the instance state in Database Instance, review Events, and verify Credit balance in OmniFabric billing |