Skip to main content Link Menu Expand (external link) Document Search Copy Copied

How do I connect to a FeatureBase cloud database with fbsql?

Connect to a FeatureBase cloud database when you startup fbsql.

Before you begin

Enter fbsql --help at the CLI to list available commands. \q quits the fbsql interface.


    --host="<hostname>" \ -(p|-port)=<port> \
    --api-key="<cloud-public-key>" |
    (--email="user-email" \ --password="<user-pass>") |
    -[d|-dbname]="<cloud-database-name>" |
    -[f|-file] <filename> |

CLI flag Prefix

Commands can be executed from the CLI or fbsql interface using the appropriate prefix:

Interface Prefix Example
CLI fbsql fbsql --config=cloud-user-connect.toml
fbsql \! \! --config=cloud-user-connect.toml

Database connection flags

Argument Description Default Additional information
--host="<hostname>" Specifies remote host name IP address or URL of the machine on which FeatureBase is running localhost  
Specify TCP port on which FeatureBase is listening for connections.    
--api-key="<public-key>" API public key flag that can be used to authenticate with your cloud organization   Obtain Cloud API key
--email="" \ --password="a1b2c3d4e5f6" User email and password credentials for FeatureBase application   Create Cloud users
--config=filename.toml Designate a TOML file containing connection details   TOML connection file

Optional arguments

Connect to available database

The following commands are equivalent:
fbsql -[d|-dbname] <cloud-database-name>

Argument Description Additional information
-[d|-dbname]="<cloud-database-name>" Connect to available Cloud database Create a Cloud database

Load SQL from a source file

Argument Description Additional information
-[f|-file] <filename> Run content from file which can include valid meta-commands and SQL queries equivalent to [i|include <filename>] meta-command

Load data from data source

Additional information

Obtain Cloud API key

There are several ways to create an API key for your FeatureBase Cloud account:

Connection file

You can setup a file containing connection details in the */fbsql/featurebase directory or in an accessible file path.

Connections files have a .toml extension and contain:

  • a valid combination of arguments and values in form argument = "value",
  • on individual lines,
  • with leading -- and trailing \ omitted.

fbsql status

fbsql displays status information at startup:

Status Description Additional information
You are not connected to a database Not connected to remote database  
connecting to database: invalid database: dbname error in database name  
dbname=# Connected to specific database  


Connect with API key

fbsql --host="" \

Connect with user credentials

fbsql --host="" \
--email="<your-account-email-address-here>" \

Connect with API key in file

Source file: cloud-api-connect.toml

host = ""

Connection string:

fbsql --config=cloud-user-connect.toml

Connect with user credentials in file

Source file: cloud-user-connect.toml

host = ""
email     = ''
password  = 'a1b2c3d4e5f6'

Connection string:

fbsql --config=cloud-user-connect.toml

Next step