Error 504 Using LabVIEW Database Connectivity API

Updated Dec 11, 2023

Reported In

Software

  • LabVIEW

Issue Details

Based on below screenshot, when sending data to SQLServer with Insert SQL statement, Error -504 occurs at DB Tools Close Connection.vi
SQLerror504.jpg

The error details are as below:
Error -504: 𝙽𝙸_𝙳𝚊𝚝𝚊𝚋𝚊𝚜𝚎_𝙰𝙿𝙸.𝚕𝚟𝚕𝚒𝚋:𝙳𝙱 𝚃𝚘𝚘𝚕𝚜 𝙲𝚕𝚘𝚜𝚎 𝙲𝚘𝚗𝚗𝚎𝚌𝚝𝚒𝚘𝚗.𝚟𝚒->𝙳𝙱 𝙶𝚛𝚊𝚙𝚑𝙳𝚊𝚝𝚊 𝙵𝚘𝚛𝚖𝚊𝚝.𝚟𝚒<𝙴𝚁𝚁>𝙰𝙳𝙾 𝙴𝚛𝚛𝚘𝚛: 0𝚡00000𝟷𝙵𝟾 𝙾𝚙𝚎𝚗 𝚛𝚎𝚌𝚘𝚛𝚍𝚜𝚎𝚝 𝚘𝚋𝚓𝚎𝚌𝚝
Β 

Solution

This error occurred because the opened recordset object reference is not released before the database connection is terminated.

If you are opening multiple recordset references by executing DB Tools Execute Query VI in a loop, try putting DB Tools Free Object VI in the For loop to ensure all opened recordset reference is released before you close the database connection.

AfterΒ putting DB Tools Free Object VI in the For loop, check if the error stopped or not.