Hello B&R Community,
With the discontinuation of the AsDB library in Automation Studio 6, projects relying on native SQL Server connectivity face migration challenges.
To help address this gap, I have published AltDB, an open-source, clean-room drop-in replacement library designed to restore MS SQL Server connectivity in Automation Studio 6 without requiring changes to existing application code.
Overview
AltDB is written directly against the published Microsoft Tabular Data Stream ([MS-TDS]) wire specification, with no FreeTDS or LGPL licensing restrictions. It preserves the exact function block interfaces, error numbers, and asynchronous state-machine behavior (ERR_FUB_BUSY) of legacy AsDb:
dbConnect()/dbConnectEnc()dbExecuteSql()dbFetchNextRow()dbGetData()dbGetAffectedRows()dbGetColumnCount()dbGetErrorMessage()dbDisconnect()dbGetInfo()
Using AltDB in an Existing Project
Replacing AsDB in an existing machine application takes just a few steps:
- Download and unzip
AltDB.zipfrom the latest GitHub release. - In Automation Studio, delete the legacy
AsDblibrary from your Logical View if it has not already been removed by the AS 6 project upgrade. - Click the Libraries button on the Automation Studio toolbar and select Existing library….
- Navigate to and select the extracted
AltDBfolder to import it into your project. - Rebuild your project. Existing task code, function block calls, and cyclic state machines remain unchanged.
Testing with ARsim and Docker
The repository includes a complete Automation Studio sample project along with a preconfigured docker-compose.yml to make local testing straightforward:
-
Clone the repository and run:
docker compose up -dThis spins up an MSSQL Server container and automatically seeds a
TestDbdatabase configured with compatibility level 120 (SQL Server 2014 mode) onlocalhost:1433. -
Open the included sample project in Automation Studio.
-
Build and transfer the project to ARsim.
-
Open the Watch window for the included recipe task and trigger
eCMD_CONNECTto test connections, table creation, record insertion, and queries.
Current Testing Status & Disclaimer
AltDB has currently been minimally validated. Feedback, bug reports, and ways in which behavior differs from AsDB are welcome.
GitHub Repository: br-automation-community/AltDB: An alternative database connection library for B&R targets
Latest Releases: Releases · br-automation-community/AltDB
I hope this helps anyone transitioning legacy AsDb codebases to Automation Studio 6.