Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Add connection examples #21

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,68 @@ Example:
}
```

#### Configuring the connectionString

You will need to modify the example connection string found in the plugin.json file in order for the plugin to find and connect to your SQL server. The connectionString is standard Microsoft SQL connection string. You can find more details about connection strings [here](https://www.connectionstrings.com/sql-server/).

**note** - Please make sure to escape the backslashes, "\", in your connection string by using two backslashes, "\\".

##### SQL Server Databases (not hosted in Azure)

Below is the example connection string included in the plugin.json: (without quotes)

```
Server=.\\SQLExpress;Database=master;Trusted_Connection=True;
```

Below is the break down of what each value represents:

* Server Name: . (shorthand for local server)
* SQL Instance: SQLExpress
* Database to connect to: Database=master
* Connection type: Trusted_Connection=True

This tells the plugin: "As the current user of the process, connect to the local server and then attach to the SQLExpress instance and open the database named master".

Connecting to another server would require the server name to be used in place of ".". For example:

```
Server=remote-server\\SQLExpress;Database=master;Trusted_Connection=True;
```

If you are not attempting to connect to the default SQL instance the SQL instance name must be provided like in the example below:

```
Server=.\\MyCustomInstance;Database=master;Trusted_Connection=True;
```

If using the default the connection string can be simplified like the following:

```
Server=remote-server;Database=master;Trusted_Connection=True;
```

##### Azure-hosted SQL Databases

The connection string for an Azure SQL database is slightly different. The example from the plugin.json is below:

```
Server=tcp:{Azure SQL Server Name}.database.windows.net,1433;Database={Azure SQL Database Name};User ID={Azure SQL User Name}@{Azure SQL Server Name};Password={Password for User Name};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;
```

It recommend to simply insert the requested details and not alter this connection string to much since it is specifically designed to work with Azure. You will only need to fill in the following details:

* Azure SQL Server Name (in two places)
* Azure SQL Database Name
* Azure SQL User Name
* Password for User Name

Below is a string that has been filled out with some test data:

```
Server=tcp:azure-sql-svr.database.windows.net,1433;Database=my-database;User ID=myUser@azure-sql-svr;Password=password;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;
```

### Additional Configuration

#### Configure permissions
Expand Down