JDBC Driver for MySQL

Build 25.0.9434

AllowUserVariables

Specifies whether user-defined variables (prefixed with @) are allowed in SQL queries. When enabled, the driver treats these as in-query user variables instead of parameter placeholders, allowing advanced SQL scripting patterns, such as variable assignment and conditional logic.

Data Type

bool

Default Value

false

Remarks

When set to 'true', the driver allows the use of user variables in SQL queries. User variables are prefixed by @ and can be declared and modified within the query itself, enabling more dynamic and script-like SQL execution.

Example:

SET @amount = 1000;  
SELECT * FROM Invoices WHERE Total > @amount;
By default ('false'), the driver interprets any value prefixed with @ as a parameter marker to be replaced by external parameter values. This is more suitable for parameterized queries executed via application code.

Enable this property if:

  • You are writing multi-statement SQL scripts
  • You want to reuse calculated values within a single SQL session
  • You are executing logic that benefits from in-query variable assignments
Note: Some SQL engines or data providers may not support user variables. Enabling this option may lead to errors if the underlying service does not allow variable declarations.

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 25.0.9434