Issue with Write-Back to Legacy System via ODBC Connection in Azure synapse

Harikrishnan Arayakeel 0 Reputation points
2025-08-21T13:04:41.22+00:00

Hi, I'm attempting to perform a write-back operation to a table in a legacy system using an ODBC connection. The DSN is configured in ODBC mode, which supports both read and write operations. We’re able to preview the data successfully using the write-back function.

This same ODBC connection is also used to pull data into synapse DigiPool for transformations, which works fine.

However, we’re encountering an error during the write-back process. I’ve attaching a error code here for reference.

Has anyone faced a similar issue or have suggestions on how to resolve this?

Thanks in advance!


{ "errorCode" : "2200"
	,"message" : "Failure happened on 'Sink' side. ErrorCode=UserErrorOdbcOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=ERROR [HY000] [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0913 - Row or object <table_name> in <library_name> type *FILE in use.,Source=Microsoft.DataTransfer.ClientLibrary.Odbc.OdbcConnector,''Type=Microsoft.DataTransfer.ClientLibrary.Odbc.Exceptions.OdbcException,Message=ERROR [HY000] [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0913 - Row or object <table_name> in <library_name> type *FILE in use.,Source=CWBODBC.DLL,'"
	,"failureType" : "UserError"
	,"target" : "Writeback data <target_name>"
	,"details" : [] }

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pratyush Vashistha 1,525 Reputation points Microsoft External Staff Moderator
    2025-08-22T05:51:36.6833333+00:00

    Hi Harikrishnan Arayakeel

    Thanks for posting your query on QnA!

    It looks like you're experiencing a write-back issue to a legacy system via an ODBC connection in Azure Synapse. The error message you're seeing, SQL0913 - Row or object <table_name> in <library_name> type *FILE in use, suggests that the table you're trying to write to is currently locked or in use by another process, which may be causing the write-back operation to fail.

    DB2 for i5/OS enforces object-level locks. The error SQL0913 means that another job or uncommitted transaction holds an exclusive lock on the target file (table), preventing concurrent write access from the Synapse sink.

    Here are a few things you might can check:

    1. Check for Open Transactions: Ensure that there are no open transactions on the table that might be locking it. You can do this by checking the session list on your DB2 instance.
    2. Concurrent Access: Make sure that there are no other applications or users that might be accessing the same table at the same time. If possible, try running your write operation during a period of low activity.
    3. Connection Pooling: Sometimes, connection pooling can lead to unexpected conflicts. Ensure that each connection is properly closed after its usage to avoid unforeseen locks.
    4. Driver Version: Confirm that you're using the latest ODBC driver for the DB2 connection. An outdated driver may cause compatibility issues.
    5. Alternative Methods: If possible, try using a different method to perform the write operation, such as a batch update or inserting records in smaller chunks, to see if the problem persists.

    Verify DB2 Locks on the i5/OS Side

    1. Ask your DB2 administrator to run the IBM i command:
    WRKOBJLCK OBJ(library_name/table_name) OBJTYPE(*FILE) 
    

    Review the output for any job holding *EXCL (exclusive) or *SHR (shared) locks.

    1. Alternatively, run SQL on the IBM i:
    SELECT JOB_NAME, JOB_USER, LOCK_STATE, OBJECT_LIBRARY, OBJECT_NAME FROM QSYS2.LOCK_INFO WHERE OBJECT_LIBRARY = 'library_name' AND OBJECT_NAME = 'table_name';
    

    Look for LOCK_STATE = ‘EXCL’.

    If you're still running into issues after checking these points, here are a few follow-up questions to gather more details:

    • What version of the ODBC driver are you using to connect to the legacy system?
    • Are there any other operations happening on the legacy database at the time you're trying to perform the write-back?
    • Have you tried performing the write operation from a different client or application to see if the issue is specific to Azure Synapse?
    • Could you provide any additional context about the legacy system and its current load or state?

    If the external write test succeeds but Synapse still errors:

    • Verify the IR node where the DSN is installed matches the same driver version and .ini settings.

    • Review ODBC trace logs for intermittent SQL0913 entries. - If external write also fails, the issue is purely DB2-side; continue to clear locks or adjust DB2 job schedules.

    Feel free to share more details, and we can continue troubleshooting! Hope this helps!

    Please "Accept as Answer" if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.

    Thanks

    Pratyush


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.