# Connecting to New Databases

The Snowflake CapStorm Salesforce Connector has the ability to back up multiple Salesforce organizations into one Snowflake instance by utilizing different databases and schemas as the backing storage for the data. When installing the application, a default ***SALESFORCE*** schema is created and accessible by the application to store Salesforce records. This schema however can only be utilized to store one Salesforce organization’s data. This page provides details on the required steps to successfully connect the Snowflake CapStorm Salesforce Connector to Snowflake databases and/or schemas.

## Granting Access for the Database and Schema to the Application

Due to the nature of Snowflake permission restrictions, an application cannot grant itself access to databases and schemas that it does not own. Explicit grants must be provided to the application to allow it access to databases and schemas that were not created directly by the application. The following SQL commands must be ran to grant access to the target database and schema for the Snowflake CapStorm Salesforce Connector. Note that the following values must be updated to the correct identifiers:

* <>: The name of the target database.
* <>: The name of the target schema within the target database.
* <>: The name of the application to grant access.

### Identifying the Name of the Application

The following command can be executed within Snowflake to provide a list of applications available in the logged in Snowflake instance. The *name* field is the target name of the application that should be utilized in the following grants.

```
/*
  Provides details about installed applications within the Snowflake instance.
*/
SHOW APPLICATIONS;
```

### SQL to Grant Database and Schema Access

```
GRANT USAGE ON DATABASE <<Database Name>> TO APPLICATION <<Application Name>>;
GRANT USAGE ON SCHEMA <<Database Name>>.<<Schema Name>> TO APPLICATION <<Application Name>>;

GRANT CREATE TABLE ON SCHEMA <<Database Name>>.<<Schema Name>> TO APPLICATION <<Application Name>>;
GRANT CREATE VIEW ON SCHEMA <<Database Name>>.<<Schema Name>> TO APPLICATION <<Application Name>>;
GRANT SELECT ON ALL TABLES IN SCHEMA <<Database Name>>.<<Schema Name>> TO APPLICATION <<Application Name>>;
GRANT INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA <<Database Name>>.<<Schema Name>> TO APPLICATION <<Application Name>>;
```

## Configuring the Application to Use the Granted Database and Schema

Once all grants have been provided to the application for the target database and schema, the database name and the schema name can be provided via the [***Setup***&#x70;age](/snowflake-salesforce-connector/reference/setup-page.md) for replication configuration.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.capstorm.com/snowflake-salesforce-connector/how-tos/connecting-to-new-databases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
