When using the MSSQL driver exceptions are ignored

Description

When using the MSSQL driver, exceptions raised in the query are ignored and the code will continue to return results (which could end up being a null value).

For example, if you run the following SQL using the JTDS driver you will get an exception:

select 1 raiserror('Oops! Something went wrong!', 16, 1);

However, run the same query using the MSSQL driver and the exception is ignored.

I've thrown together a unit test example (put in the Tickets folder)

which shows the issue.

Environment

None

Attachments

1
  • 30 Oct 2020, 08:37 pm

Activity

Show:

Martin Webb 1 November 2023 at 13:04

I too have just been bitten by this. I was able to split the queries out into multiple cfquery’s, but it took an age to identify the problem.

Brad Wood 12 August 2022 at 15:04

Is it possible to get a set of failing tests that demonstrate the remaining issues with Dan’s pull? It’s not really fair to tell him there were issues that affected things, but then not make it clear what needed fixed. I’m sure if we can see everything, we can find fixes so it can all work without needing the special flag. The default behavior is pretty poor for MSSQL so I’d really like to see us get that updated. (I ran into this again converting some client projects from ACF to Lucee this week which led to a production bug, downtime, and missing DB records confused face )

dan.switzer@givainc.com 12 August 2022 at 14:34

Unfortunately, you’ve seen all the feedback I’ve seen on the issues. We’re using the lucee.datasource.mssql.modern=true environment variable, because there were other fixes I supplied that are part of this that we needed. I have no idea what the “other issues” were, no details were ever provided. However, I know the unit tests I was running all passed. I can also say we’ve been running this in production for a while and have not seen any issues. So I’m not sure why the changes are behind an environmental flag.

Brad Wood 12 August 2022 at 14:16

Hi where did this ticket end up? Were you able to get a specific list of the issues to establish the action items needed for this fix to be the default behavior in Lucee? Reading the comment thread above, it’s not really clear what was broken.

Also note the specific behavior Adobe takes in nesting the exceptions when there is more than one error in the batch which I documented on this ticket:

https://luceeserver.atlassian.net/browse/LDEV-4140

Zac Spitzer 29 June 2021 at 14:41

one of the problems was with identity keys not being returned, i.e. https://luceeserver.atlassian.net/browse/LDEV-3487 i.e. it caused problems with other database drivers (ie. other places), sql server jdbc is a strange beast

It was simply a case of it introducing too many problems, too late in the 5.3.8 release cycle, hence the approach we took, we just had to release 5.3.8.

Also, we now have much better test service coverage on GitHub actions, with mysql, postgres, mongodb and sql server all available for testing any new PRs. https://luceeserver.atlassian.net/browse/LDEV-3555 https://github.com/lucee/Lucee/blob/5.3/.github/workflows/main.yml

Fixed

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 30 October 2020 at 20:38
Updated 1 November 2023 at 13:04
Resolved 15 April 2021 at 10:02

Flag notifications