You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/connect/jdbc/building-the-connection-url.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn about formatting the connection string used by the Microsoft
4
4
author: David-Engel
5
5
ms.author: davidengel
6
6
ms.reviewer: vanto
7
-
ms.date: 09/12/2024
7
+
ms.date: 02/26/2026
8
8
ms.service: sql
9
9
ms.subservice: connectivity
10
10
ms.topic: how-to
@@ -23,12 +23,12 @@ Where:
23
23
24
24
-**serverName** (Optional) - Is the address of the server to connect to. This address can be a DNS or IP address, or it can be `localhost` or `127.0.0.1` for the local computer. If not specified in the connection URL, the server name must be specified in the properties collection.
25
25
26
-
-**instanceName** (Optional) - Is the instance to connect to on `serverName`. If not specified, a connection to the default instance is made.
26
+
-**instanceName** (Optional) - Is the instance to connect to on `serverName`. If not specified, the driver connects to the default instance.
27
27
28
28
-**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.
29
29
30
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.
31
+
> For optimal connection performance, set the `portNumber` when you connect to a named instance. This avoids a round trip to the server to determine the port number. If you use both a `portNumber` and `instanceName`, the `portNumber`takes precedence and the `instanceName`is ignored.
32
32
33
33
-**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.
[!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 has 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 you don't specify an instance name or port number property, the driver creates a connection to the default instance. See the following examples:
76
76
77
77
- To specify a port number, use the following format:
78
78
@@ -97,7 +97,10 @@ In version 8.4 and above, escaped values can contain special characters, includi
97
97
98
98
## <aname="Connectingintegrated"></a> Connecting with integrated authentication On Windows
99
99
100
-
The JDBC driver supports the use of Type 2 integrated authentication on Windows operating systems by using the `integratedSecurity` connection string property. To use integrated authentication, copy the `mssql-jdbc_auth-<version>-<arch>.dll` file to a directory on the Windows system path on the computer where the JDBC driver is installed.
100
+
The JDBC driver supports the use of Type 2 integrated authentication on Windows operating systems by using the `integratedSecurity` connection string property. To use integrated authentication, copy the `mssql-jdbc_auth-<version>-<arch>.dll` file to any directory that is included in the Windows system `PATH` environment variable.
101
+
102
+
> [!NOTE]
103
+
> The DLL doesn't need to be in the same directory as the JDBC driver JAR file. It only needs to be in a directory listed in the system `PATH`, for example `C:\Windows\System32` or a custom directory that you add to `PATH`.
101
104
102
105
The `mssql-jdbc_auth-<version>-<arch>.dll` files are installed in the following location:
103
106
@@ -106,9 +109,9 @@ The `mssql-jdbc_auth-<version>-<arch>.dll` files are installed in the following
106
109
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.
107
110
108
111
> [!NOTE]
109
-
> 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.
112
+
> If you're 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're running a 64-bit JVM on a x64 processor, use the `mssql-jdbc_auth-<version>-<arch>.dll` file in the x64 folder.
110
113
111
-
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:
114
+
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 you installed the JDBC driver in the default directory, you can specify the location of the DLL by using the following virtual machine (VM) argument when the Java application starts:
112
115
113
116
`-Djava.library.path=C:\Microsoft JDBC Driver 6.4 for SQL Server\sqljdbc_<version>\enu\auth\x86`
Copy file name to clipboardExpand all lines: docs/connect/jdbc/using-the-jdbc-driver.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Using the JDBC driver
3
3
description: This section provides quick start instructions to make a simple connection to a SQL Server database using the Microsoft JDBC Driver for SQL Server.
4
4
author: David-Engel
5
5
ms.author: davidengel
6
-
ms.date: 03/17/2025
6
+
ms.date: 02/26/2026
7
7
ms.service: sql
8
8
ms.subservice: connectivity
9
9
ms.topic: quickstart
@@ -462,7 +462,7 @@ The following snippet is an example of the CLASSPATH statement that's used for a
462
462
Make sure that the CLASSPATH statement contains only one [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)], such as either sqljdbc.jar, sqljdbc4.jar, sqljdbc41.jar, or sqljdbc42.jar.
463
463
464
464
> [!NOTE]
465
-
> On Windows systems, directory names longer than the 8.3 filename convention or folder names with spaces may cause problems with classpaths. If you suspect these types of issues, you should temporarily move the sqljdbc.jar file, sqljdbc4.jar file, or the sqljdbc41.jar file into a simple directory name such as `C:\Temp`, change the classpath, and determine whether that addresses the problem.
465
+
> On Windows systems, directory names longer than the 8.3 filename convention or folder names with spaces may cause problems with classpaths. If you suspect these types of problems, temporarily move the sqljdbc.jar file, sqljdbc4.jar file, or the sqljdbc41.jar file into a simple directory name such as `C:\Temp`, change the classpath, and determine whether that addresses the problem.
466
466
467
467
### Applications that are run directly at the command prompt
468
468
@@ -494,17 +494,23 @@ Connection con = DriverManager.getConnection(connectionUrl);
494
494
```
495
495
496
496
> [!WARNING]
497
-
> The above connection string uses `encrypt=false`, which is not recommended for production use. For more information about encrypting your database connection with JDBC, see [Connecting with encryption](connecting-with-ssl-encryption.md).
497
+
> The above connection string uses `encrypt=false`, which isn't recommended for production use. For more information about encrypting your database connection with JDBC, see [Connecting with encryption](connecting-with-ssl-encryption.md).
498
498
499
499
Starting from JDBC API 4.0, the `DriverManager.getConnection()` method is enhanced to load JDBC drivers automatically. Therefore, applications don't need to call the `Class.forName` method to register or load the driver when using driver jar libraries.
500
500
501
-
When the getConnection method of the DriverManager class is called, an appropriate driver is located from the set of registered JDBC drivers. sqljdbc4.jar, sqljdbc41.jar, or sqljdbc42.jar file includes "META-INF/services/java.sql.Driver" file, which contains the **com.microsoft.sqlserver.jdbc.SQLServerDriver** as a registered driver. The existing applications, which currently load the drivers by using the Class.forName method, will continue to work without modification.
501
+
When you call the getConnection method of the DriverManager class, it locates an appropriate driver from the set of registered JDBC drivers. sqljdbc4.jar, sqljdbc41.jar, or sqljdbc42.jar file includes "META-INF/services/java.sql.Driver" file, which contains the **com.microsoft.sqlserver.jdbc.SQLServerDriver** as a registered driver. The existing applications, which currently load the drivers by using the Class.forName method, continue to work without modification.
502
502
503
503
> [!NOTE]
504
-
> sqljdbc4.jar, sqljdbc41.jar, or sqljdbc42.jar class library cannot be used with older versions of the Java Runtime Environment (JRE). See [System requirements for the JDBC driver](../../connect/jdbc/system-requirements-for-the-jdbc-driver.md) for the list of JRE versions supported by the [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)].
504
+
> sqljdbc4.jar, sqljdbc41.jar, or sqljdbc42.jar class library can't be used with older versions of the Java Runtime Environment (JRE). See [System requirements for the JDBC driver](../../connect/jdbc/system-requirements-for-the-jdbc-driver.md) for the list of JRE versions supported by the [!INCLUDE[jdbcNoVersion](../../includes/jdbcnoversion_md.md)].
505
505
506
506
For more information about how to connect with data sources and use a connection URL, see [Building the connection URL](../../connect/jdbc/building-the-connection-url.md) and [Setting the connection properties](../../connect/jdbc/setting-the-connection-properties.md).
507
-
508
-
## See also
509
507
510
-
[Overview of the JDBC driver](../../connect/jdbc/overview-of-the-jdbc-driver.md)
508
+
> [!TIP]
509
+
> The previous example uses `DriverManager` for simplicity. For production applications, consider using the `SQLServerDataSource` class instead, which provides connection pooling and additional configurability. For more information and examples, see [Connecting and retrieving data](connecting-and-retrieving-data.md) and [Data source sample](data-source-sample.md).
510
+
511
+
## Related content
512
+
513
+
-[Overview of the JDBC driver](../../connect/jdbc/overview-of-the-jdbc-driver.md)
514
+
-[Building the connection URL](../../connect/jdbc/building-the-connection-url.md)
515
+
-[Setting the connection properties](../../connect/jdbc/setting-the-connection-properties.md)
516
+
-[Connecting and retrieving data](connecting-and-retrieving-data.md)
This example should be considered a proof of concept only. The sample code is simplified for clarity, and does not necessarily represent best practices recommended by Microsoft. Other examples, which use the same crucial functions are available in the [GitHub sample repository](https://github.com/tediousjs/tedious/blob/master/examples/).
15
+
This example should be considered a proof of concept only. The sample code is simplified for clarity, and doesn't necessarily represent best practices recommended by Microsoft. Other examples, which use the same crucial functions are available in the [GitHub sample repository](https://github.com/tediousjs/tedious/blob/master/examples/).
16
16
17
17
## Step 1: Connect
18
18
19
-
The **new Connection** function is used to connect to SQL Database.
19
+
Use the **new Connection** function to connect to SQL Database.
20
20
21
21
```javascript
22
22
var Connection =require('tedious').Connection;
@@ -30,7 +30,7 @@ The **new Connection** function is used to connect to SQL Database.
30
30
}
31
31
},
32
32
options: {
33
-
// If you are on Microsoft Azure, you need encryption:
33
+
// If you're on Microsoft Azure, you need encryption:
34
34
encrypt:true,
35
35
database:'your_database'//update me
36
36
}
@@ -48,7 +48,7 @@ The **new Connection** function is used to connect to SQL Database.
48
48
## Step 2: Execute a query
49
49
50
50
51
-
All SQL statements are executed using the **new Request()** function. If the statement returns rows, such as a select statement, you can retrieve them using the **request.on()** function. If there are no rows, the request.on() function returns empty lists.
51
+
Execute all SQL statements using the **new Request** function. If the statement returns rows, such as a select statement, you can retrieve them using the **request.on** function. If there are no rows, the request.on function returns empty lists.
52
52
53
53
54
54
```javascript
@@ -63,7 +63,7 @@ All SQL statements are executed using the **new Request()** function. If the sta
63
63
}
64
64
},
65
65
options: {
66
-
// If you are on Microsoft Azure, you need encryption:
66
+
// If you're on Microsoft Azure, you need encryption:
67
67
encrypt:true,
68
68
database:'your_database'//update me
69
69
}
@@ -112,7 +112,7 @@ All SQL statements are executed using the **new Request()** function. If the sta
112
112
113
113
## Step 3: Insert a row
114
114
115
-
In this example you will see how to execute an [INSERT](../../t-sql/statements/insert-transact-sql.md) statement safely, passing parameters, which protect your application from [SQL injection](../../relational-databases/security/sql-injection.md) values.
115
+
In this example, you see how to execute an [INSERT](../../t-sql/statements/insert-transact-sql.md) statement safely, passing parameters, which protect your application from [SQL injection](../../relational-databases/security/sql-injection.md) values.
116
116
117
117
118
118
```javascript
@@ -127,7 +127,7 @@ In this example you will see how to execute an [INSERT](../../t-sql/statements/i
127
127
}
128
128
},
129
129
options: {
130
-
// If you are on Microsoft Azure, you need encryption:
130
+
// If you're on Microsoft Azure, you need encryption:
131
131
encrypt:true,
132
132
database:'your_database'//update me
133
133
}
@@ -170,3 +170,46 @@ In this example you will see how to execute an [INSERT](../../t-sql/statements/i
170
170
connection.execSql(request);
171
171
}
172
172
```
173
+
174
+
## Step 4: Connect with Windows authentication
175
+
176
+
The tedious driver supports Windows authentication using NTLM. To connect with domain credentials instead of SQL Server authentication, change the `authentication` section in the connection configuration:
177
+
178
+
```javascript
179
+
var Connection =require('tedious').Connection;
180
+
var config = {
181
+
server:'<server>', //update me
182
+
authentication: {
183
+
type:'ntlm',
184
+
options: {
185
+
domain:'<domain>', //update me
186
+
userName:'<username>', //update me
187
+
password:'<password>'//update me
188
+
}
189
+
},
190
+
options: {
191
+
encrypt:false,
192
+
database:'<database>', //update me
193
+
port:1433
194
+
}
195
+
};
196
+
var connection =newConnection(config);
197
+
connection.on('connect', function(err) {
198
+
if (err) {
199
+
console.log('Connection failed', err);
200
+
} else {
201
+
console.log('Connected with Windows authentication');
202
+
}
203
+
});
204
+
205
+
connection.connect();
206
+
```
207
+
208
+
> [!NOTE]
209
+
> NTLM authentication requires you to provide domain credentials in the configuration. For trusted connections that use the currently logged-in Windows user without specifying credentials, consider the [msnodesqlv8](https://www.npmjs.com/package/msnodesqlv8) package, which uses the native ODBC driver.
210
+
211
+
## Related content
212
+
213
+
-[Node.js driver for SQL Server](node-js-driver-for-sql-server.md)
214
+
-[Step 1: Configure development environment for Node.js development](step-1-configure-development-environment-for-node-js-development.md)
215
+
-[Step 2: Create a SQL database for Node.js development](step-2-create-a-sql-database-for-node-js-development.md)
Copy file name to clipboardExpand all lines: docs/database-engine/configure-windows/open-the-odbc-data-source-administrator.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Find out how to open the ODBC Data Source Administrator on various
4
4
author: rwestMSFT
5
5
ms.author: randolphwest
6
6
ms.reviewer: vanto
7
-
ms.date: 08/26/2025
7
+
ms.date: 02/26/2026
8
8
ms.service: sql
9
9
ms.subservice: configuration
10
10
ms.topic: how-to
@@ -36,6 +36,23 @@ Your computer might contain a variety of ODBC drivers, from [!INCLUDE [msCoName]
36
36
37
37
Information for the Microsoft [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] entry is displayed in the **Version** column.
38
38
39
+
### Understand ODBC driver version numbers
40
+
41
+
The **Version** column in the ODBC Data Source Administrator displays the internal file version number, which differs from the marketing version name used in product downloads and documentation.
42
+
43
+
The following table maps common marketing version names to their corresponding internal file version patterns:
44
+
45
+
| Marketing version | Internal file version pattern |
46
+
|---|---|
47
+
| ODBC Driver 18 for SQL Server | 2022.*x*.*x*|
48
+
| ODBC Driver 17 for SQL Server | 2017.*x*.*x*|
49
+
| ODBC Driver 13.1 for SQL Server | 2015.*x*.*x*|
50
+
| ODBC Driver 13 for SQL Server | 2014.*x*.*x*|
51
+
52
+
For example, if the **Version** column shows `2017.177.02.01`, the installed driver corresponds to **ODBC Driver 17 for SQL Server**.
53
+
54
+
For detailed release history, see [Release notes for the Microsoft ODBC Driver for SQL Server on Windows](../../connect/odbc/windows/release-notes-odbc-sql-server-windows.md).
55
+
39
56
## Related content
40
57
41
58
-[ODBC Data Source Administrator](../../odbc/admin/odbc-data-source-administrator.md)
0 commit comments