Reputation: 499
How do I connect to CockroachDB in Java using JDBC, e.g. what are the parameters and format of the connection string?
Upvotes: 1
Views: 1013
Reputation: 499
You can see a full example of Cockroach using jdbc
here, but here's the code snippet including the connection string:
import java.sql.*;
public static void main(String[] args)...{
Class.forName("org.postgresql.Driver");
Connection db = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:26257/[your database]?sslmode=disable", "maxroach", "");
Upvotes: 1