Support for SQL bind variables
Bind variables are a means of parameterizing SQL statements so that the statements have question marks or parameters in their where clauses, such as:
- SQL server:
select count (*) from report where tenant = @tenant
- Java JDBC:
select count (*) from report where tenant = ?
Bind variables allow the database server to prepare the statement once and execute it multiple times without reparsing or reanalyzing it.
Bind variables aren't applicable to statements that use literals, such as:
select count (*) from report where tenant = ‘xxxx’
These statements can't be parameterized and are reparsed and reanalyzed by the database server with each execution.
Bind variables generate high network and storage demands. To learn more about bind variables support and its availability, see Frequently asked questions below.
Enable capture of SQL bind variables
To enable SQL bind value capture
- Go to Settings > Server-side service monitoring > Deep monitoring.
- Expand Database and turn on/off Capture SQL bind values on the global level.
- optional To override the global setup, go to Process group override.
- To add an override, select Add process group override and select the affected process group.
- optional To select a specific process from the selected process group, select the process from the dropdown list.
- Select Add.
- Select Save changes.
Whether you enable this setting site-wide or for individual process groups, you can use Dynatrace OneAgent to capture the values of bind variables. This is applicable to the following technologies:
- ADO.net
- JDBC
- PHP database frameworks
If the array returned by executeBatch()
contains more than one element, indicating multiple commands were executed, Dynatrace masks the values of the bind variables to ensure data privacy. This is because different executions of executeBatch()
may aggregate multiple commands, necessitating the masking of bind variable values to prevent the exposure of sensitive information.
Example of masked and unmasked SQL bind values
A sample result of this feature is distributed tracing. The following webpage illustrates the masking of bind variables.
Bind variables are considered confidential as they can contain IDs and other sensitive values. Learn how to ensure the data privacy of your customers.
Only users who have permission to view a specific entity or management zone can view the bind variables within that entity or zone.
Frequently asked questions
This feature is available in:
- Dynatrace environments that are licensed via a Dynatrace Platform Subscription (DPS).
- Dynatrace environments that have switched to Version 3 of Adaptive traffic management.
- Dynatrace Managed environments.
If you don't see this feature in your Dynatrace environment, you're likely running Version 2 of Adaptive traffic management.
This is an environment-wide change. Make sure that you have your Dynatrace administrator's permission to do this.
This feature can capture a lot of sensitive data, and it can generate high network traffic and storage demands, so we recommend that you use it with caution and only for specific process groups.
In Dynatrace SaaS, Adaptive traffic management ensures that the amount of traffic sent to Dynatrace remains within your license limits. However, excessive use consumes additional trace ingress volume and leads to a lower overall OneAgent capture rate. You can track the impact of this in the OneAgent Traces - Adaptive traffic management dashboard.
In Dynatrace Managed, bind variables can lead to increased processing and storage demands for your Managed Cluster.