Skip to content

Commit 32b6418

Browse files
Merge pull request #261425 from v-thepet/postgres-terms2
PostgreSQL term pass - connect and how-to articles
2 parents 1e45f22 + 2b519ab commit 32b6418

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+389
-393
lines changed

articles/postgresql/flexible-server/connect-azure-cli.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ ms.date: 11/30/2021
1616

1717
[!INCLUDE [applies-to-postgresql-flexible-server](../includes/applies-to-postgresql-flexible-server.md)]
1818

19-
This quickstart demonstrates how to connect to an Azure Database for PostgreSQL Flexible Server using Azure CLI with ```az postgres flexible-server connect``` and execute single query or sql file with ```az postgres flexible-server execute``` command. This command allows you test connectivity to your database server and run queries. You can also run multiple queries using the interactive mode.
19+
This quickstart demonstrates how to connect to an Azure Database for PostgreSQL flexible server instance using Azure CLI with `az postgres flexible-server connect` and execute single query or sql file with `az postgres flexible-server execute` command. This command allows you test connectivity to your database server and run queries. You can also run multiple queries using the interactive mode.
2020

2121

2222
## Prerequisites
2323
- An Azure account. If you don't have one, [get a free trial](https://azure.microsoft.com/free/).
2424
- Install [Azure CLI](/cli/azure/install-azure-cli) latest version (2.20.0 or above)
25-
- Log in using Azure CLI with ```az login``` command
26-
- Turn on parameter persistence with ```az config param-persist on```. Parameter persistence will help you use local context without having to repeat numerous arguments like resource group or location.
25+
- Log in using Azure CLI with `az login` command
26+
- Turn on parameter persistence with `az config param-persist on`. Parameter persistence will help you use local context without having to repeat numerous arguments like resource group or location.
2727

28-
## Create a PostgreSQL Flexible Server
28+
## Create Azure Database for PostgreSQL flexible server instance
2929

30-
The first thing we'll create is a managed PostgreSQL server. In [Azure Cloud Shell](https://shell.azure.com/), run the following script and make a note of the **server name**, **username** and **password** generated from this command.
30+
The first thing to create is a managed Azure Database for PostgreSQL flexible server instance. In [Azure Cloud Shell](https://shell.azure.com/), run the following script and make a note of the **server name**, **username** and **password** generated from this command.
3131

3232
```azurecli
3333
az postgres flexible-server create --public-access <your-ip-address>
3434
```
3535
You can provide more arguments for this command to customize it. See all arguments for [az postgres flexible-server create](/cli/azure/postgres/flexible-server#az-postgres-flexible-server-create).
3636

3737
## View all the arguments
38-
You can view all the arguments for this command with ```--help``` argument.
38+
You can view all the arguments for this command with `--help` argument.
3939

4040
```azurecli
4141
az postgres flexible-server connect --help
@@ -123,7 +123,7 @@ test 200
123123
```
124124

125125
## Run SQL File
126-
You can execute a sql file with the command using ```--file-path``` argument, ```-f```.
126+
You can execute a sql file with the command using `--file-path` argument, `-f`.
127127

128128
```azurecli
129129
az postgres flexible-server execute -n <server-name> -u <username> -p "<password>" -d <database-name> --file-path "<file-path>"

articles/postgresql/flexible-server/connect-csharp.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@ ms.date: 11/30/2021
1616

1717
[!INCLUDE [applies-to-postgresql-flexible-server](../includes/applies-to-postgresql-flexible-server.md)]
1818

19-
This quickstart demonstrates how to connect to an Azure Database for PostgreSQL using a C# application. It shows how to use SQL statements to query, insert, update, and delete data in the database. The steps in this article assume that you are familiar with developing using C#, and that you are new to working with Azure Database for PostgreSQL.
19+
This quickstart demonstrates how to connect to an Azure Database for PostgreSQL flexible server instance using a C# application. It shows how to use SQL statements to query, insert, update, and delete data in the database. The steps in this article assume that you are familiar with developing using C#, and that you are new to working with Azure Database for PostgreSQL flexible server.
2020

2121
## Prerequisites
2222

2323
For this quickstart you need:
2424

2525
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free).
26-
- Create an Azure Database for PostgreSQL Flexible server using [Azure portal](./quickstart-create-server-portal.md) <br/> or [Azure CLI](./quickstart-create-server-cli.md) if you do not have one.
26+
- Create an Azure Database for PostgreSQL flexible server instance using [Azure portal](./quickstart-create-server-portal.md) <br/> or [Azure CLI](./quickstart-create-server-cli.md) if you do not have one.
2727
- Use the empty *postgres* database available on the server or create a [new database](./quickstart-create-server-portal.md#connect-to-the-postgresql-database-using-psql).
2828
- Install the [.NET SDK for your platform](https://dotnet.microsoft.com/download) (Windows, Ubuntu Linux, or macOS) for your platform.
2929
- Install [Visual Studio](https://www.visualstudio.com/downloads/) to build your project.
3030
- Install [Npgsql](https://www.nuget.org/packages/Npgsql/) NuGet package in Visual Studio.
3131

3232
## Get connection information
3333

34-
Get the connection information needed to connect to the Azure Database for PostgreSQL. You need the fully qualified server name and login credentials.
34+
Get the connection information needed to connect to the Azure Database for PostgreSQL flexible server instance. You need the fully qualified server name and login credentials.
3535

3636
1. Log in to the [Azure portal](https://portal.azure.com/).
3737
2. From the left-hand menu in Azure portal, click **All resources**, and then search for the server you have created (such as **mydemoserver**).
3838
3. Click the server name.
3939
4. From the server's **Overview** panel, make a note of the **Server name** and **Server admin login name**. If you forget your password, you can also reset the password from this panel.
40-
:::image type="content" source="./media/connect-csharp/1-connection-string.png" alt-text="Azure Database for PostgreSQL server name":::
40+
:::image type="content" source="./media/connect-csharp/1-connection-string.png" alt-text="Azure Database for PostgreSQL flexible server instance name.":::
4141

4242
## Step 1: Connect and insert data
4343

4444
Use the following code to connect and load the data using **CREATE TABLE** and **INSERT INTO** SQL statements. The code uses NpgsqlCommand class with method:
45-
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to the PostgreSQL database.
45+
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to the Azure Database for PostgreSQL flexible server database.
4646
- [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand) sets the CommandText property.
4747
- [ExecuteNonQuery()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlCommand.html#Npgsql_NpgsqlCommand_ExecuteNonQuery) method to run the database commands.
4848

@@ -199,7 +199,7 @@ namespace Driver
199199
## Step 3: Update data
200200

201201
Use the following code to connect and update the data using an **UPDATE** SQL statement. The code uses NpgsqlCommand class with method:
202-
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to PostgreSQL.
202+
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to Azure Database for PostgreSQL flexible server.
203203
- [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand), sets the CommandText property.
204204
- [ExecuteNonQuery()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlCommand.html#Npgsql_NpgsqlCommand_ExecuteNonQuery) method to run the database commands.
205205

@@ -265,7 +265,7 @@ namespace Driver
265265

266266
Use the following code to connect and delete data using a **DELETE** SQL statement.
267267

268-
The code uses NpgsqlCommand class with method [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to the PostgreSQL database. Then, the code uses the [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand) method, sets the CommandText property, and calls the method [ExecuteNonQuery()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlCommand.html#Npgsql_NpgsqlCommand_ExecuteNonQuery) to run the database commands.
268+
The code uses NpgsqlCommand class with method [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to the Azure Database for PostgreSQL flexible server database. Then, the code uses the [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand) method, sets the CommandText property, and calls the method [ExecuteNonQuery()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlCommand.html#Npgsql_NpgsqlCommand_ExecuteNonQuery) to run the database commands.
269269

270270
> [!IMPORTANT]
271271
> Replace the Host, DBName, User, and Password parameters with the values that you specified when you created the server and database.

0 commit comments

Comments
 (0)