Error -214727900 When Using Multiple SQL Statements in DB Tools Execute Query VI

Updated Jun 22, 2023

Reported In

Software

  • LabVIEW Database Connectivity Toolkit

Issue Details

I am using DB Tools Execute Query VI with multiple SQL statements (such as the following USE followed by CREATE TABLE IF NOT EXISTS) and it returns me an error -2147217900. If I execute the SQL Statements in MySQL Workbench, this problem does not occur. What can I do to fix this?
Error -214727900 When Using Multiple SQL Statements in DB Tools Execute Query VI -2.JPG
Error -214727900 When Using Multiple SQL Statements in DB Tools Execute Query VI.JPG
 

Solution

This is expected behavior because multiple SQL statements are not allowed by default. There are two workarounds to solve this issue:
1. Separate the SQL query for each SQL statement.
Error -214727900 When Using Multiple SQL Statements in DB Tools Execute Query VI - 3.JPG
2. Enable the "Allow multiple statements" option under the OLE DB Provider for OBDC Drivers properties. Below is an example of where you can locate it in Windows' ODBC Data Sources (32-bit) or ODBC Data Sources (64-bit).
Error -214727900 When Using Multiple SQL Statements in DB Tools Execute Query VI - 4.jpg