Example script: PostgreSQL database on Google Cloud using create-db command
The following example shows planning for and creating a Spotfire database schema for a PostgreSQL database on Google Cloud.
Use the
following code template to plan and create a database schema with the command
create-db
.
See
Creating a Spotfire database using the command create-db
for instructions.
PostgreSQL database on Google Cloud:
config create-db
--driver-class="org.postgresql.Driver"
--database-url="jdbc:postgresql://{{database-host}}:{{database-port}}/{{database-name}}"
--admin-username="{{admin-user}}"
--admin-password="{{admin-password}}"
--spotfiredb-dbname="{{spotfire-database}}"
--do-not-create-user
For each option shown in the above example,
replace the placeholder variable with your own value. The following example
shows example values to pass to the command
create-db
.
Option | Example value |
---|---|
--driver-class
|
"org.postgresql.Driver"
|
--database-url
|
"jdbc:postgresql://myservername:5432/postgres"
|
--admin-username
|
"postgres"
|
--admin-password
|
"postgres"
|
--spotfiredb-dbname
|
"myspotfiredb"
|
--do-not-create-user
|
--do-not-create-user
|
Note: Spotfire databases for PostgreSQL created on the cloud do not take
a database user name or password, which is why we use the option
--do-not-create-user
.
In the following code, we have
replaced the template variables with the example values. The command is ready
to run to create the database schema. Your values will differ.
Note: This example has line breaks to make it easier to read the assigned
values. To use this example, you must copy it to a text editor, provide your
own values, and remove the line breaks first.
config create-db
--driver-class="org.postgresql.Driver"
--database-url="jdbc:postgresql://myservername:5432/postgres"
--admin-username="postgres"
--admin-password="postgres"
--spotfiredb-dbname="myspotfiredb"
--do-not-create-user
Note: For a PostgreSQL database for AWS or Google Cloud providers:
- If you set the value of
admin-username
to something other than the defaultpostgres
, then you must set a value for the existing PostgreSQL database variabledatabase-name
(which is passed as part of the option--database-url
). - You must provide a value
for the option
spotfiredb-dbname
, which is the name of the Spotfire database that you are creating. (This name is different from the existing PostgreSQLdatabase-name
.)
This process ensures that PostgreSQL can connect to the default PostgreSQL database and create the Spotfire database schema.
Parent topic: Examples for cloud database deployments
Related information
- Example script: PostgreSQL database on AWS using create-db command
- Example script: PostgreSQL database on Azure using create-db command
- Example script: Microsoft SQL database on AWS using create-db command
- Example script: Microsoft SQL database on Google Cloud using create-db command
- Example script: Microsoft SQL database on Azure using create-db command
- Example script: Oracle database on AWS using create-db command