SQL Server deadlock when using PreparedStatements

前端 未结 1 676
离开以前
离开以前 2021-01-20 18:01

I have a java servlet application and I\'m using a prepared query to update a record in a SQL Server Database table.

Lets say I want to execute UPDATE MyTable

1条回答
  •  攒了一身酷
    2021-01-20 18:17

    Ok I finally found the problem and solution to my problem.

    It seemed that the combination of the jTDS JDBC driver with MSSQL was the 'problem'.

    This article explained my situation exactly. And with the help of this FAQ I was able to set the datasource to the right configuration.

    From what I understand:

    If you have statement that uses a String-like index (Like in my situation), the table performs an index SCAN instead of an index SEEK. This causes the whole table to be locked and vulnerable to deadlocks.

    I hope this will help other people too.

    0 讨论(0)
提交回复
热议问题