On this page
This page shows you how to use free trial credits to deploy a CockroachDB cluster on CockroachDB Standard (Preview) and use sample code to run your first queries.
Create a free trial clusterOn the Capacity page, keep the Provisioned capacity at the default value of 2 vCPUs.
Click Next: Finalize.
On the Finalize page, name your cluster. If an active free trial is listed in the right pane, you will not need to add a payment method, though you will need to do this by the end of the trial to maintain your organization's clusters.
Click Create cluster.
Your cluster will be created in a few seconds and the Create SQL user dialog will display.
The Create SQL user dialog allows you to create a new SQL user and password.
Click Next.
Currently, all new SQL users are created with admin privileges. For more information and to change the default settings, see Managing SQL users on a cluster.
Select a language to connect a sample application to your cluster. To connect to your cluster directly from the command line, refer to Connect to a Standard Cluster.
Once you create a SQL user, the Connect to cluster dialog will show information about how to connect to your cluster.
Copy the JDBC_DATABASE_URL
environment variable command provided and save it in a secure location.
Note:
The connection string is pre-populated with your username, password, cluster name, and other details. Your password, in particular, will be provided only once. Save it in a secure place (Cockroach Labs recommends a password manager) to connect to your cluster in the future. If you forget your password, a Cluster Admin can reset it. Refer to: Managing SQL users on a cluster
In a terminal, set the JDBC_DATABASE_URL
environment variable to the JDBC connection string:
icon/buttons/copy
export JDBC_DATABASE_URL="<jdbc-connection-string>"
The code sample uses the connection string stored in the environment variable JDBC_DATABASE_URL
to connect to your cluster.
In a terminal set the JDBC_DATABASE_URL
environment variable to the JDBC connection string:
icon/buttons/copy
$env:JDBC_DATABASE_URL = "<jdbc-connection-string>"
The code sample uses the connection string stored in the environment variable JDBC_DATABASE_URL
to connect to your cluster.
Clone the quickstart-code-samples
repo:
icon/buttons/copy
git clone https://github.com/cockroachdb/quickstart-code-samples
Navigate to the java
directory of the repo:
icon/buttons/copy
cd quickstart-code-samples/java
The code sample in this directory does the following:
JDBC_DATABASE_URL
environment variable.Run the application using gradlew
:
icon/buttons/copy
The output should look like this:
> Task :app:run
Hello world!
BUILD SUCCESSFUL in 3s
2 actionable tasks: 2 executed
Once you create a SQL user, the Connect to cluster dialog will show information about how to connect to your cluster.
Open the General connection string section, then copy the connection string provided and save it in a secure location.
Note:
The connection string is pre-populated with your username, password, cluster name, and other details. Your password, in particular, will be provided only once. Save it in a secure place (Cockroach Labs recommends a password manager) to connect to your cluster in the future. If you forget your password, a Cluster Admin can reset it. Refer to: Managing SQL users on a cluster
In a terminal set the DATABASE_URL
environment variable to the connection string:
icon/buttons/copy
export DATABASE_URL="<connection-string>"
The code sample uses the connection string stored in the environment variable DATABASE_URL
to connect to your cluster.
In a terminal set the DATABASE_URL
environment variable to the connection string:
icon/buttons/copy
$env:DATABASE_URL = "<connection-string>"
The code sample uses the connection string stored in the environment variable DATABASE_URL
to connect to your cluster.
Clone the quickstart-code-samples
repo:
icon/buttons/copy
git clone https://github.com/cockroachdb/quickstart-code-samples
Navigate to the node
directory of the repo:
icon/buttons/copy
cd quickstart-code-samples/node
The code sample in this directory does the following:
DATABASE_URL
environment variable.Install the app requirements:
icon/buttons/copy
Run the app:
icon/buttons/copy
The output will look like this:
Now that you have a CockroachDB Standard cluster running, try out the following:
This page highlights just one way you can get started with CockroachDB. For information on other options that are available when creating a CockroachDB cluster, see the following:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4