Repository navigation
Description
Problem
We bundle two SQL Server JDBC drivers: jTDS 1.3.1 and Microsoft's mssql-jdbc. jTDS is still the default for database = sqlserver, but it has had no release since 2013. It also needs a patched copy of one of its classes in our source tree (net.sourceforge.jtds.ssl.TdsTlsOutputStream, LGPL) to work around an unfixed TLS handshake bug (jTDS bugs/725, patches/129). It does not implement JDBC 4 methods such as isValid(), which is why DatabaseSettings special-cases sqlserver as non-JDBC4.
The Microsoft driver is maintained, handles current TLS itself, is MIT licensed, and is already shipped. #592 upgrades it from 10.2.4 to 13.6.2 and adds smoke-test coverage for it, which didn't exist before.
Proposal
Make the Microsoft driver the only bundled SQL Server driver, in two steps across two releases so existing installs aren't broken.
Phase A: switch the default and deprecate jTDS (jTDS jar still bundled)
database = sqlservermaps to the Microsoft driver, except that an existing config with ajdbc:jtds:URL and nodatabase.driverkeeps using jTDS and logs a deprecation warning. The warning is only a warning; the URL is not rewritten, because the properties file is the user's and the Microsoft driver has different URL syntax and encryption defaults.- The JDBC4 flag and test query are derived from the driver actually in use instead of from the
databasename. Today they follow the name, so an explicit jTDSdatabase.driverwould break oncesqlserveris marked JDBC4. - jTDS is marked deprecated in the shipped driver list, the reference list and
mirth.properties, and the Microsoft entry goes first. Existing installs keep their stored driver list.
Phase B: remove (a later release)
- Remove the jTDS jars, the
TdsTlsOutputStreamoverride, the jTDS CI configuration, the jTDS entries and notices, and the jTDS-specific branch inDatabaseSettings. - A jTDS user can still supply the jar themselves. For the engine's own database that means
custom-libplus an explicitdatabase.driver; for Database Reader/Writer channels a library resource. Stock jTDS lacks our TLS patch, so TLS handshakes against newer SQL Server versions may fail.
What changes for users
- Existing jTDS installs keep working through Phase A, with a warning. In Phase B they need to switch to the Microsoft driver or add the jTDS jar themselves.
- The URL syntax differs:
jdbc:jtds:sqlserver://host:port/dbbecomesjdbc:sqlserver://host:port;databaseName=db. - The Microsoft driver has defaulted to
encrypt=truesince 10.2.0, which 4.7.0 already ships. For anyone switching from jTDS this is new, so servers with self-signed certificates needtrustServerCertificate=trueor a proper trust store. - The Microsoft driver sends
Timestampparameters asdatetime2, jTDS asdatetime. Claude checked this against SQL Server 2025 with jTDS 1.3.1, mssql-jdbc 10.2.4 and 13.6.2: values stored inDATETIMEcolumns and read back are identical, and index seeks are unaffected. Comparisons differ when the parameter's milliseconds are not exactly representable inDATETIME(which only has .000, .003 and .007 steps):WHERE ts = ?stops matching rows that jTDS matched, and an inclusive upper bound ending in .999 can miss a row stored as the next whole second. Our own queries only use>=,<=and<on these columns, so only rows within a few milliseconds of a bound are affected, but custom metadata searches using equals/not equals on timestamp columns and user SQL are exposed. AddingdatetimeParameterType=datetimeto the URL gave results identical to jTDS in every case. The results were the same on SQL Server 2022 CU27. - Channels and scripts that hard-code
net.sourceforge.jtds.jdbc.Driveror ajdbc:jtds:URL are not migrated automatically. - Sybase is not supported by the Microsoft driver. I'm not aware of anyone using it through jTDS.
Open questions
- Are there Sybase or jTDS users who would object? Please say so here.
- Leave existing stored driver-list entries alone, or add a migration that removes only the entry matching the shipped jTDS default in Phase B?
- Should the Microsoft URL template and examples include
datetimeParameterType=datetime? See theDATETIMEnote above.
Tasks
- Upgrade mssql-jdbc to 13.6.2 and add a smoke-test configuration for it #592 Upgrade mssql-jdbc to 13.6.2 and add its smoke-test configuration (prerequisite)
- Phase A: URL-aware default driver, JDBC4 flag derived from the driver, and the deprecation warning
- Phase A: driver list, reference list and
mirth.propertiesdocumentation - Check
DATETIME/datetime2behavior (done on SQL Server 2022 and 2025) - Phase B: remove the jars, the override, the CI configuration and the notices
🤖 Drafted with Claude Code
Activity
mgaffigan commentedon Nov 23, 2026
I don't see this as a big enough issue to split in two. Kill it. It's easily reversible if someone has some super odd corner case - but I see no point in supporting/shipping both. It's an option without value. The "trustServerCertificate" option is de rigeur to an SQL Server admin for the past few years, most apps have already made that leap.
tonygermano commentedon Nov 23, 2026
It's actually not easily reversible because of several items detailed in this issue. As the removal of this default driver is not a critically urgent issue, I don't see a reason to not deprecate it for a release cycle before we remove it to let people prepare for the change. Splitting it into two phases allows the preliminary work to allow people to roll it back to be in the same release as the deprecation announcement.
mgaffigan commentedon Nov 23, 2026
That sounds like a reason to fix the SQL server detection logic, not to give two options. I would put $50 on no one needing this - and it only delaying pain and causing confusion.
What's the benefit over killing it in two phases instead of one? (I take as granted fixing the detection). What do we gain?
jonbartels commentedon Nov 23, 2026
Is there any plausible condition where the JTDS driver would work but the MS driver would not work? Something like the MS driver not working on older SQL Server installs but the JTDS driver working?
Even if those cases exist - What would a user need to do if they really really really needed to use JTDS? Load the custom driver, setup the driver mapping, and what else?
JTDS has been deprecated for a while, even within the old Mirth community it was getting flagged as just not working for many modern SQL Server connections - https://github.com/search?q=repo%3Anextgenhealthcare%2Fconnect+jtds&type=discussions
The user base that is potentially negatively impacted are users who have an older (or deconfigured) SQL Server installation that somehow needs the JTDS driver. My instinct is that those users are a very small population and a population that is already facing a mountain of upgrades and tech debt.
pacmano1 commentedon Nov 24, 2026
I'd advocate advance notice here. So next release keeps it, after that gone.
Reminder that Sybase still exists, but their native driver is now suitable.
mgaffigan commentedon Nov 24, 2026
All releases keep it if needed - the admin can drop it in whether we ship it or not. If we're giving "notice", we should ship it disabled or with some warning so the admin knows we're giving them "notice" - 'cause they will have no idea otherwise.
pacmano1 commentedon Nov 24, 2026
I do see a warning on use that something is deprecated and to migrate, but I am not so sure how we can do that without spamming the console except for server startup.
mgaffigan commentedon Nov 24, 2026
We can do little about it, and what we can do is negligible. It sounds like two different paths, but they give the same result:
N+1: Upgrades without noticing change log entry; no immediate breakage.
N+2: Upgrades and hits unexpected breakage; reads change log and follows remediation steps.
N+1: Upgrades without noticing change log and hits immediate, unexpected breakage; reads change log and follows remediation steps.
N+1: Either unaffected by the change, or applies remediation before upgrade to N+2.
N+2: Upgrades smoothly with no surprise breakage.
N+1: Either unaffected by the change, or spots it in the change log and applies remediation before/during upgrade.
The prudent reader avoids downtime now and in the future. The hasty user probably never sees the deprecation notice/warning (which is yet to be opened in a PR), and has the same surprise downtime.
Doing it in two steps only kicks the can down the road. It does not reduce or increase downtime for anyone - it only delays it and extends vulnerability. In either case, re-enabling the insecure component and continuing to use it indefinitely is straightforward.
We have real issues and a long backlog (see the still open and quite similar Java 25 upgrade). Rip the band aid off.
mgaffigan commentedon Nov 24, 2026
For fun, I did confirm that the legacy jtds lib is indeed vulnerable to complete loss of confidentiality and integrity on the DB. No CVEs logged against the unmaintained library, of course, but would score 7.4 as a CVE (CVSS 3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N). That would also surely allow an attacker RCE of the engine, since we trust and execute code stored in the DB.
We're contemplating knowingly shipping a dependency with a high impact vulnerability in a future release. What benefit justifies it?