Skip to content

Commit bb80d9b

Browse files
authored
Merge pull request #31819 from VanMSFT/20240912_updateFreshness2
Article refresh 09 2024 - part 2
2 parents 131b2b4 + 789fdac commit bb80d9b

32 files changed

Lines changed: 366 additions & 348 deletions

docs/connect/jdbc/building-the-connection-url.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
---
2-
title: Building the connection URL
3-
description: Article about formatting the connection string used by the Microsoft JDBC Driver for SQL Server. Samples of connection strings are included in the examples section.
2+
title: Building the connection URL with the Microsoft JDBC Driver for SQL Server
3+
description: Learn about formatting the connection string used by the Microsoft JDBC Driver for SQL Server. Samples of connection strings are included in the examples section.
44
author: David-Engel
55
ms.author: davidengel
6-
ms.date: 08/09/2023
6+
ms.reviewer: vanto
7+
ms.date: 09/12/2024
78
ms.service: sql
89
ms.subservice: connectivity
910
ms.topic: conceptual
1011
---
1112
# Building the connection URL
1213

13-
[!INCLUDE[Driver_JDBC_Download](../../includes/driver_jdbc_download.md)]
14+
[!INCLUDE [Driver_JDBC_Download](../../includes/driver_jdbc_download.md)]
1415

1516
The general form of the connection URL is
1617

1718
`jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]`
1819

19-
where:
20+
Where:
2021

2122
- **jdbc:sqlserver://** (Required) - Is known as the subprotocol and is constant.
2223

@@ -26,12 +27,12 @@ where:
2627

2728
- **portNumber** (Optional) - Is the port to connect to on `serverName`. The default is `1433`. If you're using the default port, you don't have to specify the port, nor the preceding `:` in the URL.
2829

29-
> [!NOTE]
30-
> For optimal connection performance, you should set the `portNumber` when you connect to a named instance. This will avoid a round trip to the server to determine the port number. If both a `portNumber` and `instanceName` are used, the `portNumber` will take precedence and the `instanceName` will be ignored.
30+
> [!NOTE]
31+
> For optimal connection performance, you should set the `portNumber` when you connect to a named instance. This will avoid a round trip to the server to determine the port number. If both a `portNumber` and `instanceName` are used, the `portNumber` will take precedence and the `instanceName` will be ignored.
3132
3233
- **property** (Optional) - Is one or more option connection properties. For more information, see [Setting the connection properties](setting-the-connection-properties.md). Any property from the list can be specified. Properties can only be delimited by using the semicolon (`;`), and they can't be duplicated.
3334

34-
> [!CAUTION]
35+
> [!CAUTION]
3536
> For security purposes, you should avoid building the connection URLs based on user input. You should only specify the server name and driver in the URL. For user name and password values, use the connection property collections. For more information about security in your JDBC applications, see [Securing JDBC driver applications](securing-jdbc-driver-applications.md).
3637
3738
## Connection properties
@@ -44,10 +45,10 @@ Connect to the default database on the local computer by using a user name and p
4445

4546
`jdbc:sqlserver://localhost;encrypt=true;user=MyUserName;password=*****;`
4647

47-
> [!NOTE]
48+
> [!NOTE]
4849
> Although the previous example uses a username and password in the connection string, you should use integrated security as it's more secure. For more information, see the [Connecting with integrated authentication](#Connectingintegrated) section later in this article.
4950
50-
The following connection string shows an example of how to connect to a [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] database using integrated authentication and Kerberos from an application running on any operating system supported by the [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)]:
51+
The following connection string shows an example of how to connect to a [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] database using integrated authentication and Kerberos from an application running on any operating system supported by the [!INCLUDE [jdbcNoVersion](../../includes/jdbcnoversion_md.md)]:
5152

5253
```java
5354
jdbc:sqlserver://;servername=server_name;encrypt=true;integratedSecurity=true;authenticationScheme=JavaKerberos
@@ -71,7 +72,7 @@ jdbc:sqlserver://;servername=server_name;encrypt=true;integratedSecurity=true;au
7172

7273
## Named and multiple SQL Server instances
7374

74-
[!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] allows for the installation of multiple database instances per server. Each instance is identifiable by a specific name. To connect to a named instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], you can either specify the port number of the named instance (preferred). You can also specify the instance name as a JDBC URL property or a **datasource** property. If no instance name or port number property is specified, a connection to the default instance is created. See the following examples:
75+
[!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] allows for the installation of multiple database instances per server. Each instance is identifiable by a specific name. To connect to a named instance of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)], you can either specify the port number of the named instance (preferred). You can also specify the instance name as a JDBC URL property or a **datasource** property. If no instance name or port number property is specified, a connection to the default instance is created. See the following examples:
7576

7677
- To specify a port number, use the following format:
7778

@@ -91,7 +92,7 @@ In version 8.4 and above, escaped values can contain special characters, includi
9192

9293
`jdbc:sqlserver://localhost;encrypt=true;username=MyUsername;password={pass";{}}word};`
9394

94-
> [!NOTE]
95+
> [!NOTE]
9596
> White space inside the braces is literal and not trimmed.
9697
9798
## <a name="Connectingintegrated"></a> Connecting with integrated authentication On Windows
@@ -102,9 +103,9 @@ The `mssql-jdbc_auth-<version>-<arch>.dll` files are installed in the following
102103

103104
`<installation directory>\sqljdbc_<version>\<language>\auth\`
104105

105-
For any operating system supported by the [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)], see [Using Kerberos integrated authentication to connect to SQL Server](using-kerberos-integrated-authentication-to-connect-to-sql-server.md) for a description of a feature added in [!INCLUDE[jdbc-40](../../includes/jdbc-40-md.md)] that allows an application to connect to a database using integrated authentication with Type 4 Kerberos.
106+
For any operating system supported by the [!INCLUDE [jdbcNoVersion](../../includes/jdbcnoversion_md.md)], see [Using Kerberos integrated authentication to connect to SQL Server](using-kerberos-integrated-authentication-to-connect-to-sql-server.md) for a description of a feature added in [!INCLUDE [jdbc-40](../../includes/jdbc-40-md.md)] that allows an application to connect to a database using integrated authentication with Type 4 Kerberos.
106107

107-
> [!NOTE]
108+
> [!NOTE]
108109
> If you are running a 32-bit Java Virtual Machine (JVM), use the `mssql-jdbc_auth-<version>-<arch>.dll` file in the x86 folder, even if the operating system is the x64 version. If you are running a 64-bit JVM on a x64 processor, use the `mssql-jdbc_auth-<version>-<arch>.dll` file in the x64 folder.
109110
110111
Alternatively you can set the java.library.path system property to specify the directory of the `mssql-jdbc_auth-<version>-<arch>.dll`. For example, if the JDBC driver is installed in the default directory, you can specify the location of the DLL by using the following virtual machine (VM) argument when the Java application is started:
@@ -127,6 +128,6 @@ The JDBC driver supports the use of IPv6 addresses with the connection propertie
127128

128129
`Connection con = DriverManager.getConnection("jdbc:sqlserver://;encrypt=true;integratedSecurity=true;", pro);`
129130

130-
## See also
131+
## Related content
131132

132133
- [Connecting to SQL Server with the JDBC driver](connecting-to-sql-server-with-the-jdbc-driver.md)

docs/connect/jdbc/connecting-with-ssl-encryption.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ description: Find examples of how to connect using TLS encryption in your Java a
44
author: David-Engel
55
ms.author: davidengel
66
ms.reviewer: vanto
7-
ms.date: 09/27/2023
7+
ms.date: 09/12/2024
88
ms.service: sql
99
ms.subservice: connectivity
1010
ms.topic: conceptual
1111
---
1212
# Connecting with encryption
1313

14-
[!INCLUDE[Driver_JDBC_Download](../../includes/driver_jdbc_download.md)]
14+
[!INCLUDE [Driver_JDBC_Download](../../includes/driver_jdbc_download.md)]
1515

1616
The examples in this article describe how to use connection string properties that allow applications to use Transport Layer Security (TLS) encryption in a Java application. For more information about these new connection string properties such as **encrypt**, **trustServerCertificate**, **trustStore**, **trustStorePassword**, and **hostNameInCertificate**, see [Setting the connection properties](setting-the-connection-properties.md).
1717

1818
## Configuring the connection
1919

20-
When the **encrypt** property is set to **true** and the **trustServerCertificate** property is set to **true**, the [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)] won't validate the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] TLS certificate. This setting is common for allowing connections in test environments, such as where the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] instance has only a self-signed certificate.
20+
When the **encrypt** property is set to **true** and the **trustServerCertificate** property is set to **true**, the [!INCLUDE [jdbcNoVersion](../../includes/jdbcnoversion_md.md)] won't validate the [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] TLS certificate. This setting is common for allowing connections in test environments, such as where the [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] instance has only a self-signed certificate.
2121

2222
The following code example demonstrates how to set the **trustServerCertificate** property in a connection string:
2323

@@ -28,7 +28,7 @@ String connectionUrl =
2828
"encrypt=true;trustServerCertificate=true";
2929
```
3030

31-
When the **encrypt** property is set to **true** and the **trustServerCertificate** property is set to **false**, the [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)] will validate the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] TLS certificate. Validating the server certificate is a part of the TLS handshake and ensures that the server is the correct server to connect to. To validate the server certificate, the trust material must be supplied at connection time either by using **trustStore** and **trustStorePassword** connection properties explicitly, or by using the underlying Java Virtual Machine (JVM)'s default trust store implicitly.
31+
When the **encrypt** property is set to **true** and the **trustServerCertificate** property is set to **false**, the [!INCLUDE [jdbcNoVersion](../../includes/jdbcnoversion_md.md)] will validate the [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] TLS certificate. Validating the server certificate is a part of the TLS handshake and ensures that the server is the correct server to connect to. To validate the server certificate, the trust material must be supplied at connection time either by using **trustStore** and **trustStorePassword** connection properties explicitly, or by using the underlying Java Virtual Machine (JVM)'s default trust store implicitly.
3232

3333
The **trustStore** property specifies the path (including filename) to the certificate trustStore file, which contains the list of certificates that the client trusts. The **trustStorePassword** property specifies the password used to check the integrity of the trustStore data. For more information on using the JVM's default trust store, see the [Configuring the client for encryption](configuring-the-client-for-ssl-encryption.md).
3434

@@ -55,12 +55,12 @@ String connectionUrl =
5555
"hostNameInCertificate=hostName";
5656
```
5757

58-
> [!NOTE]
58+
> [!NOTE]
5959
> Alternatively, you can set the value of connection properties by using the appropriate **setter** methods provided by the [SQLServerDataSource](reference/sqlserverdatasource-class.md) class.
6060
61-
If the **encrypt** property is **true** and the **trustServerCertificate** property is **false** and if the server name in the connection string doesn't match the server name in the TLS certificate, the following error will be issued: `The driver couldn't establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "java.security.cert.CertificateException: Failed to validate the server name in a certificate during Secure Sockets Layer (SSL) initialization."`. With version 7.2 and up, the driver supports wildcard pattern matching in the left-most label of the server name in the TLS certificate.
61+
If the **encrypt** property is **true**, the **trustServerCertificate** property is **false**, and if the server name in the connection string doesn't match the server name in the TLS certificate, the following error will be issued: `The driver couldn't establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "java.security.cert.CertificateException: Failed to validate the server name in a certificate during Secure Sockets Layer (SSL) initialization."`. With version 7.2 and up, the driver supports wildcard pattern matching in the left-most label of the server name in the TLS certificate.
6262

63-
## See also
63+
## Related content
6464

65-
[Using encryption](using-ssl-encryption.md)
66-
[Securing JDBC driver applications](securing-jdbc-driver-applications.md)
65+
- [Using encryption](using-ssl-encryption.md)
66+
- [Securing JDBC driver applications](securing-jdbc-driver-applications.md)

docs/connect/jdbc/microsoft-jdbc-driver-for-sql-server.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,45 @@ title: Microsoft JDBC Driver for SQL Server
33
description: Article on JDBC driver with SQL Server and Azure SQL Database, enabling connectivity from any Java application, server, or applet.
44
author: David-Engel
55
ms.author: davidengel
6-
ms.date: 08/09/2023
6+
ms.reviewer: vanto
7+
ms.date: 09/12/2024
78
ms.service: sql
89
ms.subservice: connectivity
910
ms.topic: conceptual
1011
---
1112
# Microsoft JDBC Driver for SQL Server
1213

13-
[!INCLUDE[Driver_JDBC_Download](../../includes/driver_jdbc_download.md)]
14+
[!INCLUDE [Driver_JDBC_Download](../../includes/driver_jdbc_download.md)]
1415

1516
In our continued commitment to interoperability, Microsoft provides a Java Database Connectivity (JDBC) driver for use with SQL Server, Azure SQL Database, and Azure SQL Managed Instance. The driver is available at no extra charge and provides Java database connectivity from any Java application, application server, or Java-enabled applet. This driver is a Type 4 JDBC driver that provides database connectivity through the standard JDBC application program interfaces (APIs).
1617

1718
The Microsoft JDBC Driver for SQL Server has been tested against major application servers such as IBM WebSphere and SAP NetWeaver.
1819

1920
## Getting started
2021

21-
* [Step 1: Configure development environment for Java development](step-1-configure-development-environment-for-java-development.md)
22-
* [Step 2: Create a database on SQL Server or Azure SQL Database for Java development](step-2-create-a-sql-database-for-java-development.md)
23-
* [Step 3: Proof of concept connecting to SQL using Java](step-3-proof-of-concept-connecting-to-sql-using-java.md)
22+
- [Step 1: Configure development environment for Java development](step-1-configure-development-environment-for-java-development.md)
23+
- [Step 2: Create a database for Java development](step-2-create-a-sql-database-for-java-development.md)
24+
- [Step 3: Proof of concept connecting to SQL using Java](step-3-proof-of-concept-connecting-to-sql-using-java.md)
2425

2526
## Documentation
2627

27-
* [Getting Started](getting-started-with-the-jdbc-driver.md)
28-
* [Overview](overview-of-the-jdbc-driver.md)
29-
* [Programming Guide](programming-guide-for-jdbc-sql-driver.md)
30-
* [Security](securing-jdbc-driver-applications.md)
31-
* [Performance and Reliability](improving-performance-and-reliability-with-the-jdbc-driver.md)
32-
* [Troubleshooting](diagnosing-problems-with-the-jdbc-driver.md)
33-
* [Code Samples](sample-jdbc-driver-applications.md)
34-
* [Compliance and Legal](compliance-and-legal-for-the-jdbc-sql-driver.md)
28+
- [Getting started with the JDBC driver](getting-started-with-the-jdbc-driver.md)
29+
- [Overview of the JDBC driver](overview-of-the-jdbc-driver.md)
30+
- [Programming guide for JDBC SQL driver](programming-guide-for-jdbc-sql-driver.md)
31+
- [Securing JDBC driver applications](securing-jdbc-driver-applications.md)
32+
- [Improving performance and reliability (JDBC)](improving-performance-and-reliability-with-the-jdbc-driver.md)
33+
- [Diagnosing problems with the JDBC driver](diagnosing-problems-with-the-jdbc-driver.md)
34+
- [Sample JDBC driver applications](sample-jdbc-driver-applications.md)
35+
- [JDBC specification compliance](compliance-and-legal-for-the-jdbc-sql-driver.md)
3536

3637
## Download
3738

3839
[Download Microsoft JDBC Driver for SQL Server](download-microsoft-jdbc-driver-for-sql-server.md) - has additional information about Maven projects, and more.
3940

4041
## Samples
4142

42-
* [Sample JDBC driver applications](sample-jdbc-driver-applications.md)
43+
- [Sample JDBC driver applications](sample-jdbc-driver-applications.md)
4344

44-
## Also see
45+
## Related content
4546

46-
[Feedback and finding other JDBC driver information](finding-additional-jdbc-driver-information.md)
47+
[Finding additional JDBC driver information](finding-additional-jdbc-driver-information.md)

0 commit comments

Comments
 (0)