> # SQL Support

> See "SQL Escape Sequences" for information about the SQL escape sequences supported by the JDBC driver.

> ### Binding SQL Statements

> A JDBC application can prepare a query that contains dynamic parameters. Each parameter in a SQL statement must be associated, or bound, to a variable in the application before the statement is executed. When the application binds a variable to a parameter, it describes that variable and that parameter to the driver. Therefore, the application must supply the following information:

> - The data type of the variable that the application wishes to map to the dynamic parameter.
> - The SQL data type of the dynamic parameter (the data type that the database system assigned to the parameter marker).

> The JDBC driver relies on the binding of parameters to know how to send information to the database system in its native format. The host variable data type and SQL data type are assumed to be the same. For example, setInt() indicates to the driver that the data type of the host variable and the SQL type of the dynamic parameter are both Integer. If the host variable and SQL data type are not the same, the application should use setObject() to specify the application variable data type and the SQL data type. If an application furnishes incorrect parameter binding information to the JDBC driver, the results will be unpredictable.

> To ensure interoperability, the JDBC driver uses only the parameter binding information provided by the application. Although some DBMSs can publish dynamic parameter information back to a JDBC driver, others cannot. For example, both the SQL Server and Oracle query processors can determine that a parameter is an integer. However, the Oracle query processor cannot publish this information back to the SequeLink for JDBC driver.

> NOTES:

> - The SQL data type is determined at prepare time by the database and does not change for the life of the statement. The SQL data type is not dependent on the data being used by the application. For example, it is not valid to bind the SQL type to SQL_NUMERIC with a precision of 15 and a scale of 5, and then bind it on a later execution to a SQL type of SQL_NUMERIC with a precision of 13 and a scale of 3.
> - You can implement ParameterMetaData only when a database system publishes parameter information after prepare time. The JDBC driver returns this information when the application requests it, but depending on the database, performance penalties can be incurred. You can tune this feature through the SequeLink data source service attribute DataSourceDescribeParam. Refer to the SequeLink Administrator's Guide for information on service attributes.