Importing Data Into CockroachDB Serverless With DBeaver
Assuming you’ve setup CockroachLabs Serverless product with DBeaver, there’s just a few more steps. In summary they are:
- Create a new bank database
- Connect to that database
- Run the import data script linked below
Create a new bank database
While still connected to the “deafultdb”, run a short SQL query with the following: “create database bank;”
If at any point you get stuck or have made a mistake, you can always start over by running “drop database bank” and repeating the above step from the same SQL tab.
Connect to bank database
Now that there is a bank database, you can connect to it in the same way you connected to the “defaultdb”. Run through the same DBeaver steps in Setting up a SQL GUI with CockroachDB but use the database “bank” instead of defaultdb.
Run the import data script
Now that you can connect to the bank database, do so by opening a new SQL script and connection to that database. This can be done by right clicking (or option clicking on a mac) on the bank database line and scrolling to the New SQL Script option.
Download the following SQL script and/or copy/paste it into the new SQL script tab: https://raw.githubusercontent.com/LogstonEducation/CockroachDB/main/bank.sql
Finally, run the script by clicking the “Execute SQL Script” button on the left side of the script tab.
That’s it! Your data should be loaded and you should be able to run queries on this table.