[ 
https://issues.apache.org/jira/browse/EMPIREDB-283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16742323#comment-16742323
 ] 

Gunnar Kappei commented on EMPIREDB-283:
----------------------------------------

Dear Rainer,

thanks for your quick response.

I was able to reproduce the issue using the basic sample app. This is the 
stacktrace:

*** Step 7: updateEmployee() ***
org.apache.empire.db.exceptions.RecordUpdateInvalidException: Updating the 
record 4 in EMPLOYEES failed. It might have been changed or deleted by another 
user.
org.apache.empire.db.exceptions.RecordUpdateInvalidException: Updating the 
record 4 in EMPLOYEES failed. It might have been changed or deleted by another 
user.
    at org.apache.empire.db.DBRowSet.updateRecord(DBRowSet.java:833)
    at org.apache.empire.db.DBRecord.update(DBRecord.java:861)
    at org.apache.empire.samples.db.SampleApp.updateEmployee(SampleApp.java:313)
    at org.apache.empire.samples.db.SampleApp.main(SampleApp.java:123)

I was using *v7.0.0 of the JDBC-driver*. But you get the same result with older 
drivers, e.g. v4.2 or v6.2.2.

But I've to correct my former post: I debugged my program again and the count 
of records affected by the UPDATE is '1' which is the expected / correct 
result. Though I would swear this wasn't the case a few weeks ago - but maybe I 
don't remember correctly...

Regards,

Gunnar

 

 

> PreparedStatements not working with MS SQL-Server > 2012
> --------------------------------------------------------
>
>                 Key: EMPIREDB-283
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-283
>             Project: Empire-DB
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: empire-db-2.4.4, empire-db-2.4.6, empire-db-2.4.7
>         Environment: JAVA 8, WIN2K12R2, MS-SQL-SRV > 2012, JDBC-Driver 4.2, 
> 6.0, 7.0
>            Reporter: Gunnar Kappei
>            Priority: Major
>
> Since the company I'm working at upgraded their database-servers from MS-SQL 
> 2012 to 2016, there seems to be an issue when using PreparedsStatements 
> together with Empire-DB.
> When enabling PreparedStatements via 
> DBDatabase#setPreparedStatementsEnabled(true), it's not possible to perfom 
> SQL-UPDATEs.
> Debugging the sources I found out, that the problem is located nside the 
> executeSql-method of the DBDatabase / DBDatabaseDriverMSSQL classes.  The 
> number of affected records is < 0. Therefore an exception is thrown. There is 
> no issue with INSERT statements.
> When disabling PreparedStatements, the code is working fine again since it 
> did for years now. Tried Empire-DB 2.4.4, 2.4.6, 2.4.7 and several versions 
> of the official JDBC driver from MS. On several database-servers. Getting the 
> same result every time. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to