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/odbc/linux-mac/data-access-tracing-with-the-odbc-driver-on-linux.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: "Data Access Tracing with the ODBC Driver on Linux and macOS"
3
-
description: "Learn how to enable tracing on Linux and macOS with the Microsoft ODBC Driver for SQL Server to output a log file when troubleshooting application behavior."
2
+
title: Data Access Tracing on Linux and macOS
3
+
description: Learn how to enable tracing on Linux and macOS with the Microsoft ODBC Driver for SQL Server to output a log file when troubleshooting application behavior.
The unixODBC Driver Manager on macOS and Linux supports tracing of ODBC API call entry and exit of the ODBC Driver for [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)].
23
23
24
24
To trace your application's ODBC behavior, edit the `odbcinst.ini` file's `[ODBC]` section to set the values `Trace=Yes` and `TraceFile`
25
-
to the path of the file which is to contain the trace output; for example:
25
+
to the path of the file that is to contain the trace output. For example:
26
26
27
27
```ini
28
28
[ODBC]
29
29
Trace=Yes
30
30
TraceFile=/home/myappuser/odbctrace.log
31
31
```
32
32
33
-
(You may also use `/dev/stdout` or any other device name to send trace output there instead of to a persistent file.) With the above settings, every time an application loads the unixODBC Driver Manager, it will record all the ODBC API calls which it performed into the output file.
33
+
(You may also use `/dev/stdout` or any other device name to send trace output there instead of to a persistent file.) With the above settings, every time an application loads the unixODBC Driver Manager, it will record all ODBC API calls made, into the output file.
34
34
35
35
After you finish tracing your application, remove `Trace=Yes` from the `odbcinst.ini` file to avoid the performance penalty of tracing, and ensure any unnecessary trace files are removed.
In this case, you can add `Trace=Yes` to the `[ODBC Driver 17 for SQL Server]` section of `/home/myappuser/odbcinst.ini`.
44
44
45
-
## Determining which odbc.ini File the Driver is Using
45
+
## Determining which odbc.ini file the driver is using
46
46
47
-
The Linux and macOS ODBC drivers do not know which `odbc.ini` is in use, or the path to the `odbc.ini` file. However, information about which `odbc.ini` file is in use is available from the unixODBC tools `odbc_config` and `odbcinst`, and from the unixODBC Driver Manager documentation.
47
+
The Linux and macOS ODBC drivers don't know which `odbc.ini` is in use, or the path to the `odbc.ini` file. However, information about which `odbc.ini` file is in use is available from the unixODBC tools `odbc_config` and `odbcinst`, and from the unixODBC Driver Manager documentation.
48
48
49
-
For example, the following command prints (among other information) the location of system and user `odbc.ini` files which contain, respectively, system and user DSNs:
49
+
For example, the following command prints (among other information) the location of system and user `odbc.ini` files that contain, respectively, system and user DSNs:
50
50
51
-
```
51
+
```bash
52
52
$ odbcinst -j
53
53
unixODBC 2.3.1
54
54
DRIVERS............: /etc/odbcinst.ini
@@ -62,10 +62,10 @@ SQLSETPOSIROW Size.: 8
62
62
63
63
The [unixODBC documentation](http://www.unixodbc.org/doc/UserManual/) explains the differences between user and system DSNs. In summary:
64
64
65
-
- User DSNs --- these are DSNs which are only available to a specific user. Users can connect using, add, modify, and remove their own user DSNs. User DSNs are stored in a file in the user's home directory, or a subdirectory thereof.
65
+
- User DSNs -DSNs that are only available to a specific user. Users can connect using, add, modify, and remove their own user DSNs. User DSNs are stored in a file in the user's home directory, or a subdirectory.
66
66
67
-
- System DSNs --- these DSNs are available for every user on the system to connect using them, but can only be added, modified, and removed by a system administrator. If a user has a user DSN with the same name as a system DSN, the user DSN will be used upon connections by that user.
67
+
- System DSNs - these DSNs are available for every user on the system to connect using them, but can only be added, modified, and removed by a system administrator. If a user has a user DSN with the same name as a system DSN, the user DSN will be used upon connections by that user.
The ODBC drivers for Linux and macOS support [!INCLUDE[ssHADR](../../../includes/sshadr_md.md)]. For more information about [!INCLUDE[ssHADR](../../../includes/sshadr_md.md)], see:
19
-
20
-
-[Availability Group Listeners, Client Connectivity, and Application Failover (SQL Server)](../../../database-engine/availability-groups/windows/listeners-client-connectivity-application-failover.md)
21
-
22
-
-[Creation and Configuration of Availability Groups (SQL Server)](../../../database-engine/availability-groups/windows/creation-and-configuration-of-availability-groups-sql-server.md)
23
-
24
-
-[Failover Clustering and AlwaysOn Availability Groups (SQL Server)](../../../database-engine/availability-groups/windows/failover-clustering-and-always-on-availability-groups-sql-server.md)
The ODBC drivers for Linux and macOS support [!INCLUDE[ssHADR](../../../includes/sshadr_md.md)]. For more information about [!INCLUDE[ssHADR](../../../includes/sshadr_md.md)], see:
20
+
21
+
-[Availability Group Listeners, Client Connectivity, and Application Failover (SQL Server)](../../../database-engine/availability-groups/windows/listeners-client-connectivity-application-failover.md)
22
+
23
+
-[Creation and Configuration of Availability Groups (SQL Server)](../../../database-engine/availability-groups/windows/creation-and-configuration-of-availability-groups-sql-server.md)
24
+
25
+
-[Failover Clustering and AlwaysOn Availability Groups (SQL Server)](../../../database-engine/availability-groups/windows/failover-clustering-and-always-on-availability-groups-sql-server.md)
You can specify the availability group listener of a given availability group in the connection string. If an ODBC application on Linux or macOS is connected to a database in an availability group that fails over, the original connection is broken and the application must open a new connection to continue work after the failover.
29
30
30
-
The ODBC drivers on Linux and macOS iterate sequentially through all IP addresses associated with a DNS hostname if you are not connecting to an availability group listener, and multiple IP addresses are associated with the hostname.
31
+
The ODBC drivers on Linux and macOS iterate sequentially through all IP addresses associated with a DNS hostname if you aren't connecting to an availability group listener, and multiple IP addresses are associated with the hostname.
31
32
32
-
If the DNS server's first returned IP address is not connectable, these iterations can be time consuming. When connecting to an availability group listener, the driver attempts to establish connections to all IP addresses in parallel. If a connection attempt succeeds, the driver discards any pending connection attempts.
33
+
If the DNS server's first returned IP address isn't connectable, these iterations can be time consuming. When connecting to an availability group listener, the driver attempts to establish connections to all IP addresses in parallel. If a connection attempt succeeds, the driver discards any pending connection attempts.
33
34
34
-
> [!NOTE]
35
+
> [!NOTE]
35
36
> Because a connection can fail due to an availability group failover, implement connection retry logic; retry a failed connection until it reconnects. Increasing connection timeout and implementing connection retry logic increases the chance of connecting to an availability group.
36
37
37
-
## Connecting With MultiSubnetFailover
38
+
## Connecting with MultiSubnetFailover
38
39
39
40
Always specify **MultiSubnetFailover=Yes** when connecting to a [!INCLUDE[ssSQL11](../../../includes/sssql11-md.md)] availability group listener or [!INCLUDE[ssSQL11](../../../includes/sssql11-md.md)] Failover Cluster Instance. **MultiSubnetFailover** enables faster failover for all Availability Groups and failover cluster instance in [!INCLUDE[ssSQL11](../../../includes/sssql11-md.md)]. **MultiSubnetFailover** also significantly reduces failover time for single and multi-subnet AlwaysOn topologies. During a multisubnet failover, the client attempts connections in parallel. During a subnet failover, the driver aggressively retries the TCP connection.
40
41
41
-
The **MultiSubnetFailover** connection property indicates that the application is being deployed in an availability group or Failover Cluster Instance. The driver tries to connect to the database on the primary [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] instance by trying to connect to all the IP addresses. When connecting with **MultiSubnetFailover=Yes**, the client retries TCP connection attempts faster than the operating system's default TCP retransmit intervals. **MultiSubnetFailover=Yes** enables faster reconnection after failover of either an AlwaysOn Availability Group or an AlwaysOn Failover Cluster Instance. **MultiSubnetFailover=Yes** applies to both single- and multi-subnet Availability Groups and Failover Cluster Instances.
42
+
The **MultiSubnetFailover** connection property indicates that the application is being deployed in an availability group or Failover Cluster Instance. The driver tries to connect to the database on the primary [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] instance by trying to connect to all the IP addresses. When connecting with **MultiSubnetFailover=Yes**, the client retries TCP connection attempts faster than the operating system's default TCP retransmit intervals. **MultiSubnetFailover=Yes** enables faster reconnection after failover of either an AlwaysOn Availability Group or an AlwaysOn Failover Cluster Instance. **MultiSubnetFailover=Yes** applies to both single- and multi-subnet Availability Groups and Failover Cluster Instances.
42
43
43
44
Use **MultiSubnetFailover=Yes** when connecting to an availability group listener or Failover Cluster Instance. Otherwise, your application's performance can be negatively affected.
44
45
45
-
Note the following when connecting to a server in an availability group or Failover Cluster Instance:
46
-
47
-
- Specify **MultiSubnetFailover=Yes** to improve performance when connecting to a single subnet or multi-subnet Availability Group.
46
+
Note the following recommendations when connecting to a server in an availability group or Failover Cluster Instance:
48
47
49
-
- Specify the availability group listener of the availability group as the server in your connection string.
50
-
51
-
- You cannot connect to a [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] instance configured with more than 64 IP addresses.
48
+
- Specify **MultiSubnetFailover=Yes** to improve performance when connecting to a single subnet or multi-subnet Availability Group.
52
49
53
-
- Both [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] Authentication or Kerberos Authentication can be used with **MultiSubnetFailover=Yes** without affecting the behavior of the application.
50
+
-Specify the availability group listener of the availability group as the server in your connection string.
54
51
55
-
-You can increase the value of **loginTimeout**to accommodate for failover time and reduce the application's connection retry attempts.
52
+
- You can't connect to a [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] instance configured with more than 64 IP addresses.
56
53
57
-
- Distributed transactions are not supported.
58
-
59
-
If read-only routing is not in effect, connecting to a secondary replica location in an availability group fails in the following situations:
60
-
61
-
1. If the secondary replica location is not configured to accept connections.
62
-
63
-
2. If an application uses **ApplicationIntent=ReadWrite** and the secondary replica location is configured for read-only access.
64
-
65
-
A connection fails if a primary replica is configured to reject read-only workloads and the connection string contains **ApplicationIntent=ReadOnly**.
54
+
- Both [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] Authentication or Kerberos Authentication can be used with **MultiSubnetFailover=Yes** without affecting the behavior of the application.
66
55
56
+
- You can increase the value of **loginTimeout** to accommodate for failover time and reduce the application's connection retry attempts.
57
+
58
+
- Distributed transactions aren't supported.
59
+
60
+
If read-only routing isn't in effect, connecting to a secondary replica location in an availability group fails in the following situations:
61
+
62
+
- If the secondary replica location isn't configured to accept connections.
63
+
64
+
- If an application uses **ApplicationIntent=ReadWrite** and the secondary replica location is configured for read-only access.
65
+
66
+
A connection fails if a primary replica is configured to reject read-only workloads and the connection string contains **ApplicationIntent=ReadOnly**.
Two ODBC connection string keywords support [!INCLUDE[ssHADR](../../../includes/sshadr_md.md)]:
70
73
71
-
## ODBC Syntax
74
+
-**ApplicationIntent**
75
+
76
+
-**MultiSubnetFailover**
77
+
78
+
For more information about ODBC connection string keywords, see [Using Connection String Keywords with SQL Server Native Client](../../../relational-databases/native-client/applications/using-connection-string-keywords-with-sql-server-native-client.md).
72
79
73
-
Two ODBC connection string keywords support [!INCLUDE[ssHADR](../../../includes/sshadr_md.md)]:
74
-
75
-
-**ApplicationIntent**
76
-
77
-
-**MultiSubnetFailover**
78
-
79
-
For more information about ODBC connection string keywords, see [Using Connection String Keywords with SQL Server Native Client](../../../relational-databases/native-client/applications/using-connection-string-keywords-with-sql-server-native-client.md).
80
-
81
80
The equivalent connection attributes are:
82
-
83
-
-**SQL_COPT_SS_APPLICATION_INTENT**
84
-
85
-
-**SQL_COPT_SS_MULTISUBNET_FAILOVER**
86
-
87
-
For more information about ODBC connection attributes, see [SQLSetConnectAttr](../../../relational-databases/native-client-odbc-api/sqlsetconnectattr.md).
88
-
89
-
An ODBC application that uses [!INCLUDE[ssHADR](../../../includes/sshadr_md.md)] can use one of two functions to make the connection:
90
-
91
-
|Function|Description|
92
-
|------------|---------------|
93
-
|[SQLConnect Function](../../../odbc/reference/syntax/sqlconnect-function.md)|**SQLConnect** supports both **ApplicationIntent** and **MultiSubnetFailover** via a data source name (DSN) or connection attribute.|
94
-
|[SQLDriverConnect Function](../../../odbc/reference/syntax/sqldriverconnect-function.md)|**SQLDriverConnect** supports **ApplicationIntent** and **MultiSubnetFailover** via DSN, connection string keyword, or connection attribute.|
95
-
96
-
## See Also
97
-
98
-
[Connection String Keywords and Data Source Names (DSNs)](../../../connect/odbc/linux-mac/connection-string-keywords-and-data-source-names-dsns.md)
For more information about ODBC connection attributes, see [SQLSetConnectAttr](../../../relational-databases/native-client-odbc-api/sqlsetconnectattr.md).
87
+
88
+
An ODBC application that uses [!INCLUDE[ssHADR](../../../includes/sshadr_md.md)] can use one of two functions to make the connection:
89
+
90
+
|Function|Description|
91
+
|--|--|
92
+
|[SQLConnect Function](../../../odbc/reference/syntax/sqlconnect-function.md)|**SQLConnect** supports both **ApplicationIntent** and **MultiSubnetFailover** via a data source name (DSN) or connection attribute.|
93
+
|[SQLDriverConnect Function](../../../odbc/reference/syntax/sqldriverconnect-function.md)|**SQLDriverConnect** supports **ApplicationIntent** and **MultiSubnetFailover** via DSN, connection string keyword, or connection attribute.|
94
+
95
+
## See also
96
+
97
+
[Connection String Keywords and Data Source Names (DSNs)](connection-string-keywords-and-data-source-names-dsns.md)
0 commit comments