Establishing a Connection
The objects available within our connector are accessible from the "cdata.cockroachdb" module. To use the module's objects directly:
- Import the module as follows:
import cdata.cockroachdb as mod
- To establish a connection string, call the connect() method from the connector object using an appropriate connection string, such as:
mod.connect("User=root;Password=root;Database=system;Server=localhost;Port=26257")
Connecting to CockroachDB
Set the following to connect to data.
- Server: The host name or IP address of the server.
- Port: The port number of the CockroachDB server. If not specified, the default port is 26257.
- Database: The name of the Cockroach database. If not specified, the connector connects to the user's default database.
- User: The Cockroach DB user account used to authenticate.
- Password: The password used to authenticate the user.