You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chore(mssql): upgrade the SQL Server JDBC driver to 13.6.2 and fix the type and error bugs found in testing - #42639
Driver upgrade. The SQL Server plugin moves from mssql-jdbc 11.2.4.jre11 to 13.6.2.jre11, the latest stable release. Later SQL Server authentication work needs it. Per-user Microsoft Entra tokens need accessTokenCallback (12.4), and Kerberos on Java 23 and later needs 12.9. The image runs Java 25.
Host check. The host goes into the JDBC URL as it is. So a host such as db;authenticationScheme=NTLM could add connection properties. validateDatasource and createConnectionPool now refuse a host with ;, =, {, } or a control character. The database name already had this check. A named instance (host\SQLEXPRESS) is still accepted.
Column types that always failed. Any SELECT that included a rowversion or datetimeoffset column failed, on the old driver and the new one, and so did a sql_variant holding a datetimeoffset. All now return a value.
Errors from later statements. In a query with several statements, an error after the first statement was hidden. The query reported success and the first statement's count, while earlier statements committed. It now fails with the error.
Bound time values.WHERE time_col = {{…}} with prepared statements on failed ("time and datetime are incompatible"). The URL now sets sendTimeAsDatetime=false.
Parts 3 to 5 were found by testing every SQL Server type, with prepared statements on and off. Each was the same on 11.2.4 and 13.6.2. The full test plan and results are in Notion: SQL Server driver upgrade test plan, sections 10 to 12.
The driver is declared only in mssqlPlugin/pom.xml. Each plugin loads with its own class loader, and 13.6.2 adds no required dependencies, so no other integration is affected.
Adds vectorTypeSupport=off; to the URL, so a vector column (SQL Server 2025, Azure SQL) still comes back as a JSON string. Adds the host check in validateDatasource and before the URL is built.
MssqlErrorMessages.java
New DS_INVALID_HOST_ERROR_MSG
MssqlExecuteUtils.java
Returns rowversion as hex and datetimeoffset as ISO 8601 text with its offset
MssqlDriverBehaviourTest.java (new)
Pins the JSON value of each column type, affectedRows, the failed-login message, the vector setting, and the rowversion and datetimeoffset formats (NULL, offset 0, a negative offset, no fraction, a view). Values for the other types were recorded on 11.2.4. Every case runs with prepared statements on and off.
MssqlHostValidationTest.java (new)
Accepted and refused hosts, in validation and in datasourceCreate
Behavior changes
A multi-statement query now fails when any statement fails. The message is "A statement in this query failed. Other statements in the query may already have run. ". Statements that already ran are not undone. An app whose success handler ran for such a query will now get its error handler. affectedRows is still the first statement's count.
A bound time value is sent as time. A time filter works. A bound time written into a datetime column gets the date 1900-01-01, not 1970-01-01. Time-like text bound into a varchar column is stored as 13:45:30.0000000, not Jan 1 1970 1:45PM.
affectedRows for an insert that fires a trigger, with prepared statements off. It is now the insert's own count. Before, it was the trigger's count. For example, an insert of 1 row whose trigger writes 3 rows now reports 1, not 3. With prepared statements on (the default), it still reports 3. No driver setting restores the old value. A trigger with SET NOCOUNT ON has no count of its own, so it is not affected.
A host with ;, =, {, } or a control character is refused with "Invalid host: the host must not contain ';', '=', '{', '}' or control characters." A saved datasource with such a host now fails Test configuration and queries until the host is fixed.
Test configuration fails faster. A wrong database, a refused port or an unknown host now fails in about 1 second, not about 30. An unreachable address fails in about 9 seconds, not about 31. The error messages are the same.
Everything else matched on both drivers: every column type, the other update counts, error messages, a query longer than 30 seconds, and a connection reused after sitting idle.
rowversion and datetimeoffset (fixed in this PR)
The column-type handling in MssqlExecuteUtils matched Postgres type names, so on both drivers:
rowversion failed with "The conversion from timestamp to DATE is unsupported". SQL Server reports it as timestamp, and the plugin read the 8 bytes as a date. It now comes back as hex, such as 0x0000000000000FA1, as SQL Server Management Studio shows it.
datetimeoffset failed because the plugin returned the driver's DateTimeOffset object, which the JSON mapper cannot write. It now comes back as ISO 8601 text that keeps the offset and every fractional digit, such as 2024-02-29T13:45:30.1234567+05:30.
Notes for reviewers and users:
Offset 0 prints as Z, and trailing zeros in the fraction are dropped. For example, 13:45:30.1200000 +00:00 becomes 2024-02-29T13:45:30.12Z.
rowversion is hex, while varbinary stays base64. rowversion is a version token, and hex is how SQL Server shows it.
To pass a rowversion back into a query, convert it. With prepared statements on, the value is sent as text, and SQL Server does not read text as hex. So UPDATE … WHERE rv = {{Table1.selectedRow.rv}} never matches and silently updates 0 rows, with no error. This is the usual optimistic-locking pattern, where 0 rows normally means "someone else changed the row", so the mistake is easy to miss. Use WHERE rv = CONVERT(binary(8), {{Table1.selectedRow.rv}}, 1). This is not a regression, because the column could not be read before. It needs to go into the SQL Server page of the docs.
A datetimeoffset value inside a sql_variant column still fails the query, before and after this PR. A sql_variant that holds any other type works.
No app could depend on the old behavior, because these SELECTs always failed.
Rollback
A driver problem: revert only the version line in mssqlPlugin/pom.xml. That keeps the host check. On 11.2.4, with every other change in place, all tests pass except the trigger counts above. 11.2.4 accepts vectorTypeSupport.
Reverting the whole PR also removes the host check.
No saved data changes. Fresh installs and upgrades need no configuration change.
Next
The "Enabled, verify certificate" SSL mode is the follow-up PR (APP-16551).
Automation
/ok-to-test tags="@tag.All"
Testing
Client unit tests
Server unit tests
Cypress
Playwright
Deploy preview
Not applicable
Local runs (SQL Server 2022, Testcontainers, Java 25):
13.6.2: 98 of 98 plugin tests pass, 69 of them new, on SQL Server 2019, 2022 and 2025 (-Dmssql.test.image=…). The type snapshot also passes in UTC and in America/Los_Angeles.
MssqlDataTypeMatrixTest pins about 60 type cases: a literal insert, a bound insert with prepared statements on and off, a read in both modes, and a bound filter in both modes. Results: src/test/resources/mssql-data-type-matrix.txt. The file is the same on 2019, 2022 and 2025.
On SQL Server 2025, json and vector work. Without vectorTypeSupport=off, vector comes back as unreadable bytes, so the setting is needed.
11.2.4 with every other change in place (pom-only rollback): everything passes except the trigger count and 2 matrix lines. On 11.2.4, a datetimeoffset of 0001-01-01 comes back 2 days early, and 13.6.2 fixes that.
With the old MssqlExecuteUtils, the type snapshot fails with "The conversion from timestamp to DATE is unsupported".
A local script compared error messages, failure times, a 35-second query and idle reuse on both drivers.
OSV lists no vulnerabilities for either driver version.
rowversion returns 0x0000000000000FA1, and datetimeoffset returns 2024-02-29T13:45:30.1234567+05:30. Offset 0 returns 2024-02-29T13:45:30.12Z, and SYSDATETIMEOFFSET() returns a value.
With prepared statements on, binary = {{"0x0000000000000FA1"}} gives no match, and binary = CONVERT(binary(8), {{"0x0000000000000FA1"}}, 1) gives a match. This confirms the note above.
Deploy preview (built from 3df0a34) against Azure SQL, round 2:
A test table with 20 column types, including json and vector(3). Created, written with literals and with bindings, and read back with prepared statements on and off.
Bound filters on time, date, datetimeoffset, lower-case uniqueidentifier, nvarchar with Japanese and emoji, datetime, bigint as text, and rowversion with CONVERT. All match.
A multi-statement query with a failing second statement now fails with the new message, with prepared statements on and off.
Trigger count: 3 with prepared statements on, 1 with them off. The same as locally.
SQL Server 2019 now runs in the automated tests. The cases not yet run are listed in the test plan, section 11.
Suggested Cypress tags or specs: @tag.Datasource (MsSQL_Basic_Spec, MsSQLDataSourceStub_spec, Port_Number_Placeholder_Spec)
Communication
Should the DevRel and Marketing teams inform users about this change?
Yes
No
Release note: the SQL Server driver is upgraded. A query with several statements now fails when any statement fails, instead of reporting success. A bound time value can now filter a time column. Queries that return rowversion or datetimeoffset columns now work: rowversion comes back as hex (0x…), and datetimeoffset as ISO 8601 text with its offset. With prepared statements off, affectedRows for an insert that fires a trigger now counts the insert's rows. Hosts containing ;, =, { or } are refused. A sql_variant holding a datetimeoffset now works too.
…the host
Driver (APP-16536):
- Bump mssql-jdbc from 11.2.4.jre11 to 13.6.2.jre11. Later work needs it:
per-user Entra tokens need accessTokenCallback (12.4), and Kerberos on
Java 23 and later needs 12.9.
- Set vectorTypeSupport=off, so a vector column (SQL Server 2025, Azure
SQL) still comes back as a JSON string.
Host check:
- The host goes into the JDBC URL as it is, so a host such as
"db;authenticationScheme=NTLM" could add connection properties.
validateDatasource and createConnectionPool now refuse a host with ;,
=, {, } or a control character, as the database name check does.
Tests:
- MssqlDriverBehaviourTest pins the JSON value of each column type and
affectedRows, recorded on 11.2.4, with prepared statements on and off.
- With prepared statements off, an insert that fires a trigger now
reports its own count (1), not the trigger's (3). Prepared statements
on still report 3. The test pins both.
- MssqlHostValidationTest covers accepted and refused hosts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
MSSQL datasource setup now rejects hosts containing semicolons, equals signs, braces, or control characters and displays an error for invalid hosts.
MSSQL query results now format timestamp and rowversion values as hexadecimal and preserve offsets in datetimeoffset values.
Errors in later statements within a query are now reported instead of being silently missed.
Bound time values are now sent to SQL Server as time.
Compatibility
Updated the MSSQL JDBC driver.
MSSQL connections now disable native vector type support.
The MSSQL plugin upgrades its JDBC driver and adds vectorTypeSupport=off and sendTimeAsDatetime=false to the JDBC URL. It rejects endpoint hosts containing semicolons, equals signs, braces, or ISO control characters during datasource validation and connection pool creation. It formats timestamp and rowversion values as uppercase hexadecimal and datetimeoffset values as ISO offset date-time strings. It also drains later query results and reports errors that occur while reading them. New tests cover host validation, driver behavior, and SQL data-type outcomes.
The driver upgrade, host validation and result-formatting changes show no concrete merge-blocking defect. The remaining feedback concerns test style conventions only.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the SQL Server JDBC driver upgrade to 13.6.2 and the type and error fixes. The changeset matches both: the pom.xml version bump, the rowversion and datetimeoffset handling in MssqlExec…
Description check
The description follows the template's main sections: Description with a linked issue, Testing with checkboxes, and Communication with a yes/no answer. It explains the five parts, behavior changes, ro…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the SQL Server JDBC driver upgrade to 13.6.2 and the type and error fixes. The changeset matches both: the pom.xml version bump, the rowversion and datetimeoffset handling in MssqlExecuteUtils, and the multi-statement error change. The title omits the host validation and the bound time change, which are also significant. It is specific and accurate, so it passes.
Full details: Description check
Explanation
The description follows the template's main sections: Description with a linked issue, Testing with checkboxes, and Communication with a yes/no answer. It explains the five parts, behavior changes, rollback, and test evidence in detail. The template's Suggested Cypress tags field is filled in. The 'Fixes' lines link Linear issues, which is an accepted form of issue reference. A TL;DR is absent, but the description is over 500 words, so the template asks for one. That is a minor gap. Overall the description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Automatic approval policy
Commit: 38fd1b80ffbe.
Setting
Effective value
Source
Automatic approvals
Enabled
Global configuration
Merge risk
Low
Global configuration
Security risk
Not set
Global configuration
Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.
These calls use block() instead of the required reactive-test API. Use StepVerifier to check the emitted result and terminal signal. Keep pool cleanup when changing the datasource assertions.
As per coding guidelines: “StepVerifier for anything that returns Mono or Flux.”
Apply the required conventions to this new test class.
Use AssertJ assertions. Make the class and methods package-private. Rename the four tests to should_<expectedBehavior>_when_<condition>. Add the Given, When, and Then separators. Apply these changes only to the new class.
This keeps the new regression suite consistent with the repository’s test-authoring contract.
As per coding guidelines: “AssertJ … for assertions,” “Visibility: package-private class and methods, no public,” “Name: should_<expectedBehavior>_when_<condition>,” and “Body: // Given, // When, // Then comment separators, in that order.”
Also applies to: 48-48, 142-142, 186-187, 212-212, 230-230
Use the required conventions for the new test suite.
Apply the conventions to all three new tests and their class:
Use package-private visibility.
Rename methods to should_<expectedBehavior>_when_<condition>.
Add // Given, // When, and // Then separators.
Replace JUnit boolean assertions with AssertJ assertions.
Use the prescribed Mockito fixture instead of the shared executor. Stub the connection-pool configuration for the creation test.
Keep StepVerifier for datasourceCreate.
This keeps the new suite consistent with the repository's assertion and fixture conventions.
As per coding guidelines: “AssertJ … for assertions,” “Mockito with @ExtendWith(MockitoExtension.class),” “Name: should_<expectedBehavior>_when_<condition>,” “Body: // Given, // When, // Then,” and “Visibility: package-private class and methods, no public.”
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
…ailing
Any SELECT that included one of these columns failed, on both drivers:
- rowversion: SQL Server reports it as "timestamp", which the plugin read
as a date ("The conversion from timestamp to DATE is unsupported").
It now comes back as hex, such as 0x0000000000000FA1, as SQL Server
shows it.
- datetimeoffset: the plugin returned the driver's DateTimeOffset object,
which the JSON mapper cannot write. It now comes back as ISO 8601 text
that keeps the offset, such as 2024-02-29T13:45:30.1234567+05:30.
Offset 0 prints as Z.
The type snapshot now includes both columns. New tests pin NULL, offset
0, a negative offset, datetimeoffset(0), and a view with aliases, with
prepared statements on and off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
salevine
changed the title
chore(mssql): upgrade the SQL Server JDBC driver to 13.6.2 and check the host
chore(mssql): upgrade the SQL Server JDBC driver to 13.6.2, check the host, fix rowversion and datetimeoffset
Nov 17, 2026
…est every type
Found by testing every SQL Server data type with prepared statements on
and off. Each was the same on driver 11.2.4 and 13.6.2:
- A query with several statements reported success when a later
statement failed, and showed the first statement's count. The plugin
now reads every result, so the query fails with the error. The message
says other statements in the query may already have run.
- WHERE time_column = {{binding}} failed with "time and datetime are
incompatible": the driver sent a bound time as datetime. The URL now
sets sendTimeAsDatetime=false. A bound time written to a datetime
column now gets the date 1900-01-01 instead of 1970-01-01.
- A datetimeoffset value inside a sql_variant column failed the query. It
now comes back as ISO 8601 text, like a datetimeoffset column.
Tests:
- MssqlDataTypeMatrixTest pins, for about 60 type cases, a literal
insert, a bound insert with prepared statements on and off, a read in
both modes, and a bound WHERE filter in both modes. Results are in
src/test/resources/mssql-data-type-matrix.txt.
- MssqlDriverBehaviourTest covers errors in later statements, including
after rows and in a stored procedure, and multi-result queries that
must still succeed (PRINT, RAISERROR severity 10, NOCOUNT, procedures).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
…-Dmssql.test.image
The tests run on mcr.microsoft.com/mssql/server:2022-latest by default.
-Dmssql.test.image=mcr.microsoft.com/mssql/server:2019-latest (or
2025-latest) runs the same suite on that version. All 98 tests and the
data-type matrix give the same result on 2019, 2022 and 2025.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Apply the required conventions to the three new tests.
Use StepVerifier for the executeParameterized publishers and AssertJ for value assertions. Rename these methods to should_<expectedBehavior>_when_<condition>, remove public, and add the required separators. Limit these changes to the three new methods.
As per coding guidelines: “StepVerifier for anything that returns Mono or Flux”; “AssertJ … for assertions”; “Visibility: package-private class and methods”; and the specified test-name and // Given, // When, // Then rules.
Also applies to: 302-312, 335-336, 347-357, 384-385, 400-400
Use a parameterized test for CASES, with an independent snapshot comparison for each case. This lets one failing case report its differences without preventing assertions for later cases.
Use AssertJ assertions and StepVerifier for the Mono calls. Preserve the expected failed-query outcomes. Make the class and methods package-private, use the required test name, and add the required body separators.
As per coding guidelines: “The same logic across several inputs is one @ParameterizedTest”; “AssertJ … for assertions”; “StepVerifier for anything that returns Mono or Flux”; “package-private class and methods”; “should_<expectedBehavior>_when_<condition>”; and “// Given, // When, // Then”.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The concern depends on concurrent execution in the same JVM. The inspected configuration shows no parallel JUnit setting and no fork setting in the server build. Serialized execution is the default, so the UTC window cannot overlap another timezone-sensitive test in this configuration. The timezone is captured at line 286 and restored at line 298 within the same class lifecycle.
salevine
changed the title
chore(mssql): upgrade the SQL Server JDBC driver to 13.6.2, check the host, fix rowversion and datetimeoffset
chore(mssql): upgrade the SQL Server JDBC driver to 13.6.2 and fix the type and error bugs found in testing
Nov 17, 2026
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Inserts by leaving columns out, with DEFAULT VALUES, with the DEFAULT
keyword and with OUTPUT, with prepared statements on and off, and reads
the rows back. Inserting into a computed column fails with SQL Server's
message. The result is the same on driver 11.2.4 and 13.6.2, and on
Azure SQL through the deploy preview.
A whole-number decimal comes back in exponent form (10.00 as 1E+1),
because Jackson strips trailing zeros. The test pins that.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
New tests do not follow the app/server/** Java test conventions.
All methods in this file are new, so the rules apply to each of them:
The class and test methods are public. They must be package-private.
Names such as columnTypes_returnTheRecordedJson do not follow should_<expectedBehavior>_when_<condition>.
Bodies have no // Given, // When, // Then separators.
Assertions use JUnit assertEquals, assertTrue, assertFalse and assertNotNull. They must use AssertJ (assertThat).
The tests call .block() on Mono results (run, laterStatementError_failsTheQuery, errorAfterRows_failsTheQuery, testDatasource_withAWrongPassword_showsTheLoginFailedMessage). They must use StepVerifier.
Some tests check more than one behavior. identityDefaultAndComputedColumns_workAndReadBack covers several insert forms plus a refusal. laterStatementError_failsTheQuery checks both the failure and the committed UPDATE. Split these.
The JUnit 5 imports are compliant. Fix the other points for the added methods only. Do not restructure pre-existing tests.
As per path instructions and coding guidelines, app/server/** tests use "AssertJ (assertThat, assertThatThrownBy) for assertions", "StepVerifier for anything that returns Mono or Flux", should_<expectedBehavior>_when_<condition> names, // Given/// When/// Then bodies, "package-private class and methods, no public", and "One behaviour per test".
Also applies to: 141-141, 200-200, 249-250, 467-467
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Clarify whether TIME bindings into datetime columns must keep their 1970-01-01 date.
Setting sendTimeAsDatetime=false applies to every setTime binding. For a datetime target, the stored date changes from 1970-01-01 to 1900-01-01. The insert still succeeds, so the change is silent. The PR intends the time send, and the test matrix records this datetime result. No inspected requirement says existing datetime storage must remain compatible.
Decide whether this compatibility change is accepted. If it is not accepted, document the change or limit the time send to time columns.
The comment's coverage premises are wrong. The matrix test already covers the sql_variantdatetimeoffset select with an ISO offset expectation, in both prepared modes. The "only tested value is CAST(42 AS int)" claim is also wrong. The branch is not shown to be dead code, and the evidence points toward it being live. No defect or missing test remains for this branch.
… and known issues (#3106)
## Description
Rewrites the Microsoft SQL Server reference page
(`connect-data/reference/querying-mssql.md`). Linear: APP-16556.
**Do not merge before Appsmith v2.8 is released.** The page describes
v2.8 behaviour that ships with
[appsmithorg/appsmith#42639](appsmithorg/appsmith#42639),
the SQL Server JDBC driver upgrade from 11.2 to 13.6. Each difference is
marked "v2.8 and later" or "before v2.8".
What the page adds:
- **Supported servers:** SQL Server 2019, 2022 and 2025, and Azure SQL.
TLS 1.2 or later. The driver version for each Appsmith version.
- **Connection parameters:** match the current form labels and defaults.
When to use each SSL mode, and a faster failed "Test configuration" from
v2.8.
- **Query examples:** new examples for getting the new ID with `OUTPUT`,
`IN` lists with `STRING_SPLIT`, and stored procedures with output
parameters.
- **Prepared statements:** how a bound value's type is detected, and the
`N'…'` prefix when prepared statements are off.
- **Data types:** how every SQL Server type comes back, with notes on
date-times, large numbers, exponent-form decimals, spatial and hierarchy
types, `rowversion` and time values.
- **Queries with several statements:** only the first result is
returned, how `affectedRows` is counted, error handling, and `SET`
options that stay on pooled connections.
- **Differences between versions:** a table of every behaviour that
changed in v2.8.
- **Known issues before v2.8:** with workarounds.
- **Troubleshooting:** a table of common errors.
Every behaviour on the page was checked in the driver upgrade testing:
- automated tests on SQL Server 2019, 2022 and 2025, run with both
driver versions;
- manual tests on Azure SQL.
The results are in the APP-16536 test plan.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Description
When a SQL Server query ran past its timeout, the user got the timeout
error on time, but the query kept running. It held a worker thread and a
pooled connection until it finished, and forever if it never finished.
This PR stops the query itself at its timeout.
Fixes internal security finding
[AIP-FD-38](https://app.hacktron.ai/appsmith-inc/findings/AIP-FD-38) (no
GitHub issue).
### The problem
The server wraps each plugin call in its own `.timeout()`
(`ActionExecutionSolutionCEImpl`). That timeout fires on time and
returns the standard timeout error, but it only stops waiting. The
plugin's own `.timeout()` never fired: the query runs as a blocking call
before that timer starts. So nothing stopped the query.
With a 3-second timeout, measured with the server's outer timeout in
place:
| Query | `release` (and before #42639) | This PR |
| --- | --- | --- |
| `SELECT 1; WHILE 1 = 1 SELECT 1` | Timeout error after 3 s. Connection
still in use 5 s later, and forever | Timeout error after 3 s.
Connection returned |
| `WAITFOR DELAY '00:00:20'` | Timeout error after 3 s. Query keeps
running on SQL Server until it ends at 20 s | Timeout error after 3 s.
Query cancelled on SQL Server, connection returned |
Before #42639 (driver 11.2.4) the endless queries hung the same way. So
this is not a regression from the driver upgrade. That PR moved the
endless reading into the plugin's own loop (`drainRemainingResults`,
which reads later results to find their errors), where the finding
spotted it.
### Changes
- `MssqlPlugin.executeCommon`: set the JDBC query timeout from the
action timeout, rounded up to whole seconds
(`MssqlExecuteUtils.queryTimeoutSeconds`). The driver cancels the query
on SQL Server when it runs out.
- `MssqlExecuteUtils`: check the same deadline for each row of the first
result and for each later result and row. When it passes, cancel the
query and fail with `QUERY_TIMEOUT_ERROR_MSG`: "The query ran longer
than its timeout of N ms, so Appsmith stopped it. Statements in the
query that already ran may have been saved."
- A driver timeout while later results are read is reported as a
timeout, not as "A statement in this query failed".
- If cancelling fails, the timeout is still reported.
### Behavior change
- **What users see does not change.** A query that runs past its timeout
still returns the standard error, `PE-QRY-5000` "<query> timed out in N
milliseconds. Please increase timeout…", at the timeout. The audit log
(EE) still records `query.executed` with status FAILED and response code
`PE-QRY-5000`. The server's timer starts before the plugin's, so the
server's error comes first. The plugin's own timeout message is a
backstop.
- **What changes:** the query is now cancelled on SQL Server at its
timeout. Before, it kept running in the background after the user saw
the timeout. For example, an `UPDATE` that timed out still finished
later. Now it stops. Statements that already ran may have been saved, as
before.
## Automation
/ok-to-test tags="@tag.All"
## Testing
- [ ] Client unit tests
- [x] Server unit tests
- [ ] Cypress
- [ ] Playwright
- [ ] Deploy preview
- [ ] Not applicable
- `MssqlDriverBehaviourTest#endlessLaterResults_stopAtTheQueryTimeout`
(Testcontainers, SQL Server 2022): endless results, endless update
counts and a 20-second `WAITFOR`, with prepared statements on and off.
It checks the exact error, that the query fails in under 10 seconds, and
that the connection goes back to the pool. On `release` it hangs or
wrongly succeeds.
- `MssqlExecuteUtilsTest` (mocked statements): the plugin's own deadline
cancels and fails, a driver timeout reads as a timeout, a later
statement's error before the deadline is still reported as a failed
statement, and the timeout rounds up to whole seconds.
- Full SQL Server plugin suite: 117 tests, 0 failures.
Suggested Cypress tags or specs: `@tag.Datasource`
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [x] Yes
- [ ] No
## Release note
```release-note
When a SQL Server query runs past its timeout, Appsmith now also stops it on SQL Server. Before, the query kept running in the background after the timeout error, holding a database connection, and a slow `UPDATE` could still finish later. Statements in the query that ran before the timeout may already be saved. If a query needs more time, increase its timeout in the query's settings.
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: Cypress test results -->
> [!IMPORTANT]
> 🟣 🟣 🟣 Your tests are running.
> Tests running at:
<https://github.com/appsmithorg/appsmith/actions/runs/44590810359>
> Commit: 7d82f00
> Workflow: `PR Automation test suite`
> Tags: `@tag.All`
> Spec: ``
> <hr>Thu, 19 Nov 2026 18:43:46 UTC
<!-- end of auto-generated comment: Cypress test results -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…tion (#42652)
## Description
> [!TIP]
> **TL;DR:** SQL Server datasources can now sign in with a Windows
(Active Directory) account through Kerberos. Choose **Authentication
type → Windows (Kerberos)** and enter the account as `user@REALM` with
its password. This works on self-hosted Appsmith that has Kerberos
settings (krb5.conf) and can reach the domain controller. SQL Server
login stays the default, and existing datasources do not change.
Many on-premises SQL Servers allow only Windows authentication. Until
now, Appsmith could connect to them only with a SQL Server login.
This PR adds Kerberos with a domain service account's user name and
password. It is the first of three options:
- **Option A (this PR):** one service account per datasource.
- **Option B (later):** each Appsmith user's own Windows account,
through Kerberos delegation.
- **Option C (later):** each user's own Microsoft Entra ID account.
Decisions:
- Kerberos only. NTLM is not supported, because it is often blocked and
Microsoft is phasing it out.
- Community Edition.
- No keytab upload for now. A keytab is a file made from the account's
password, and it is no safer than a stored password. It can be added if
a customer needs it.
Fixes https://linear.app/appsmith/issue/APP-16568
Depends on #42639 (driver 13.6.2, merged).
### How it works
1. The plugin logs in to the domain controller itself, with the
datasource's user name and password. It never reads or writes a Kerberos
ticket cache. So a ticket cached on the Appsmith server, for example
after someone ran `kinit`, can never be used by a datasource.
2. It gives the driver the resulting credential (`gsscredential`). The
driver gets a service ticket for `MSSQLSvc/host:port` and signs in to
SQL Server with it. The password never goes to SQL Server.
3. The credential is reused until 5 minutes before it expires, so a pool
of 10 connections logs in once.
4. When the domain controller refuses the username or password, the
plugin waits before it tries that username and password again: 1 minute,
then 2, 4 and 8, then every 15 minutes. Without the wait, the pool's
retries could lock out the AD account.
- The refusal is recorded once for the whole Appsmith server, keyed by
the account and a keyed hash of the password. So a rebuilt pool, such as
after a stale connection or for each **Test**, still waits.
- A different password is tried at once.
- Other failures, such as an unreachable domain controller, don't start
a wait.
Two mssql-jdbc 13.6 behaviours shaped this. Both were checked in the
driver source:
- The driver forgets a supplied credential after each logon attempt, but
retries once by default. The retry would then run without the credential
and hide SQL Server's real error. So Kerberos datasources set
`connectRetryCount=0;transparentNetworkIPResolution=false`.
- The driver's own Kerberos login reads a JVM-wide JAAS file, or a
ticket cache with `useDefaultJaasConfig`. Kerberos datasources point it
at a JAAS entry that does not exist, so it can never run.
### Where it works and where it does not
✅ means supported by design and covered by the automated tests, up to
SQL Server receiving the ticket. Accepting the ticket needs a real
domain. That is the manual checklist under Testing, and it is not done
yet.
| Case | Works? | Notes |
|---|---|---|
| Self-hosted Appsmith (Docker, Docker Compose, Kubernetes/Helm) | ✅ Yes
| Needs krb5.conf and network access, see below. |
| On-premises SQL Server 2019, 2022 or 2025 joined to Active Directory |
✅ Yes | The SQL Server service account needs a registered SPN,
`MSSQLSvc/<host>:<port>`. |
| SQL Server on a Linux host or container joined to AD | ✅ Yes | The
same SPN and keytab setup that Microsoft documents for SQL Server on
Linux. |
| SQL Server on an Azure or AWS VM joined to AD | ✅ Yes | Same as
on-premises. |
| Default instance on port 1433 | ✅ Yes | |
| Named instance on a fixed port | ✅ Yes | Enter the port. The SPN must
name that port. |
| Always On listener, DNS alias or IP address | ✅ Yes | Enter the
registered name in **Server SPN**. |
| Username `user@REALM`, such as `svc_appsmith@CORP.EXAMPLE.COM` | ✅ Yes
| The realm is upper-cased automatically. |
| Username with no `@REALM` | ✅ Yes | Uses `default_realm` from
krb5.conf. |
| Account in a trusted domain or another forest | ⚠️ Not tested | Needs
`[capaths]` or `[domain_realm]` in krb5.conf. |
| Named instance on a dynamic port (SQL Browser) | ⚠️ Not tested | Use a
fixed port. |
| Username as `DOMAIN\user` | ❌ No | Refused with a hint to use
`user@REALM`. |
| NTLM | ❌ No | Not supported, by decision. |
| Local Windows accounts (not domain accounts) | ❌ No | Kerberos needs a
domain account. |
| Keytab or gMSA instead of a password | ❌ Not yet | Can be added if a
customer needs it. |
| Each Appsmith user signing in as themselves | ❌ Not yet | Options B
and C. |
| Appsmith Cloud | ❌ No | Cloud has no krb5.conf and cannot reach a
customer's domain controller. |
| Azure SQL Database and Azure SQL Managed Instance | ❌ No | They do not
accept on-premises Kerberos. Microsoft Entra ID is planned (option C). |
| Amazon RDS for SQL Server | ⚠️ Not tested | Needs RDS joined to AWS
Managed Microsoft AD. |
**What the admin must set up**
- **krb5.conf:** put it at `/etc/krb5.conf` in the Appsmith container,
or set `APPSMITH_JAVA_ARGS=-Djava.security.krb5.conf=<path>`. Use a path
without spaces.
- On Docker, mount the file.
- On Helm, use a ConfigMap with `extraVolumes` and `extraVolumeMounts`.
No chart change is needed.
- The file is read again on each login.
- **Network:** the Appsmith server must reach the domain controller on
port 88 (TCP and UDP), resolve the AD domain in DNS, and keep its clock
within 5 minutes of the domain controller.
- **SQL Server:** the account needs a SQL Server login and access to the
database.
**Known limits**
- Export and Git import: the authentication type is cleared along with
the credentials. Choose Windows (Kerberos) again after import.
- All Kerberos datasources on one Appsmith server share its krb5.conf.
- Password expiry: when the account's password expires or changes, the
datasource fails until someone updates the password in it.
- Rollback: an older Appsmith version ignores the authentication type.
Kerberos datasources then fail with "Login failed" until they are
switched to a SQL Server login.
### Errors
Common failures show a plain hint instead of the raw Kerberos text:
- wrong user name or password, or a disabled or locked-out account;
- expired password;
- clock skew;
- unknown realm;
- no krb5.conf;
- domain controller unreachable;
- SPN not registered;
- SQL Server refused the ticket;
- no SQL Server login for the account.
Every "wrong account" answer from the domain controller (codes 6, 14,
18, 24 and 31, with or without detail text after the code) shows the
same message. So the **Test** button cannot be used to find out which
accounts exist.
If the JVM setting `sun.security.krb5.principal` names a different
account, the login is refused, because Java would otherwise sign in as
that account instead of the datasource's.
### Stored data
The authentication type and server SPN are stored in
`datasourceConfiguration.properties`. `DBAuth` is unchanged and there is
no migration.
A datasource without the setting uses a SQL Server login, as before. The
editor fills in a form's default values only for new datasources, so
when someone edits an older datasource, the value can arrive without its
key. The plugin then reads the value from the form's slot. A test checks
that the slots in `form.json` match.
## Automation
/ok-to-test tags="@tag.All"
## Testing
- [ ] Client unit tests
- [x] Server unit tests
- [x] Cypress
- [ ] Playwright
- [ ] Deploy preview
- [ ] Not applicable
Suggested Cypress tags or specs: `@tag.Datasource` (MsSQL_Basic_Spec,
MsSQLDataSourceStub_spec, Port_Number_Placeholder_Spec)
**Automated**
The full SQL Server plugin suite runs on SQL Server 2022 with 0
failures.
New tests:
- `MssqlKerberosLoginTest`: runs against a real Kerberos server inside
the test (Apache Kerby, test scope only). It covers the right password,
a wrong password, an unknown account, the default realm, getting a
service ticket, and that no ticket cache or keytab is used.
- `MssqlKerberosConnectionTest`: runs the whole plugin with Kerby and a
SQL Server 2022 container.
- The container is not joined to a domain, so its answer, "untrusted
domain" (error 18452), shows that the plugin logged in, got a service
ticket and sent it to SQL Server.
- A wrong password fails at the Kerberos login and never reaches SQL
Server.
- SQL Server login still connects.
- `MssqlKerberosDataSourceTest`: credential reuse and renewal; the wait
after a refusal, kept across a rebuilt pool and skipped for a new
password or for other failures; error text without the password; and the
driver settings.
- `MssqlKerberosFailuresTest`: the growing wait, the password hash key,
and that old records are dropped.
- `MssqlKerberosErrorsTest`: each error hint, and the shared message for
a bad account.
- `MssqlKerberosValidationTest`: validation, reading a value without its
key, and the default for older datasources.
- `MssqlFormSlotsTest`: `form.json` slots match the code.
**Manual: needs a real domain**
- [ ] A domain-joined SQL Server accepts a correct account, and queries
run.
- [ ] A wrong password shows the hint. Repeated **Test** clicks do not
lock the account.
- [ ] A custom Server SPN, such as an alias, connects.
- [ ] Run `kinit` as another user on the Appsmith host. The datasource
still connects as its own account.
- [ ] An existing SQL Server datasource opens with "SQL Server login"
selected, and saves and works unchanged.
- [ ] After an Appsmith restart, a saved Kerberos datasource reconnects.
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [x] Yes
- [ ] No
Docs: appsmithorg/appsmith-docs#3107
## Release note
```release-note
SQL Server datasources can now sign in with a Windows (Active Directory) account, using Kerberos with the account's username and password. Set **Authentication type** to **Windows (Kerberos)** and enter the account as `user@REALM`. Existing SQL Server datasources do not change.
This works on self-hosted Appsmith only. The Appsmith server needs your Kerberos settings in `/etc/krb5.conf` (or a path set with `APPSMITH_JAVA_ARGS=-Djava.security.krb5.conf=<path>`) and must reach your domain controller on port 88. NTLM, keytab files, group Managed Service Accounts, Azure SQL Database and Appsmith Cloud are not supported. See [Connect to SQL Server with Windows Authentication](https://docs.appsmith.com/connect-data/how-to-guides/connect-sql-server-with-windows-authentication).
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: Cypress test results -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/44833219386>
> Commit: f95c766
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=44833219386&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 20 Nov 2026 23:38:22 UTC
<!-- end of auto-generated comment: Cypress test results -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR has five parts.
mssql-jdbc11.2.4.jre11 to 13.6.2.jre11, the latest stable release. Later SQL Server authentication work needs it. Per-user Microsoft Entra tokens needaccessTokenCallback(12.4), and Kerberos on Java 23 and later needs 12.9. The image runs Java 25.db;authenticationScheme=NTLMcould add connection properties.validateDatasourceandcreateConnectionPoolnow refuse a host with;,=,{,}or a control character. The database name already had this check. A named instance (host\SQLEXPRESS) is still accepted.rowversionordatetimeoffsetcolumn failed, on the old driver and the new one, and so did asql_variantholding adatetimeoffset. All now return a value.WHERE time_col = {{…}}with prepared statements on failed ("time and datetime are incompatible"). The URL now setssendTimeAsDatetime=false.Parts 3 to 5 were found by testing every SQL Server type, with prepared statements on and off. Each was the same on 11.2.4 and 13.6.2. The full test plan and results are in Notion: SQL Server driver upgrade test plan, sections 10 to 12.
The driver is declared only in
mssqlPlugin/pom.xml. Each plugin loads with its own class loader, and 13.6.2 adds no required dependencies, so no other integration is affected.Fixes https://linear.app/appsmith/issue/APP-16536
Fixes https://linear.app/appsmith/issue/APP-14437 (
rowversion: "The conversion from timestamp to DATE is unsupported")Fixes https://linear.app/appsmith/issue/APP-15393 (
datetimeoffset: "Java 8 date/time typejava.time.OffsetDateTimenot supported")Changes
mssqlPlugin/pom.xmlmssql-jdbc11.2.4.jre11 to 13.6.2.jre11MssqlPlugin.javavectorTypeSupport=off;to the URL, so avectorcolumn (SQL Server 2025, Azure SQL) still comes back as a JSON string. Adds the host check invalidateDatasourceand before the URL is built.MssqlErrorMessages.javaDS_INVALID_HOST_ERROR_MSGMssqlExecuteUtils.javarowversionas hex anddatetimeoffsetas ISO 8601 text with its offsetMssqlDriverBehaviourTest.java(new)affectedRows, the failed-login message, the vector setting, and therowversionanddatetimeoffsetformats (NULL, offset 0, a negative offset, no fraction, a view). Values for the other types were recorded on 11.2.4. Every case runs with prepared statements on and off.MssqlHostValidationTest.java(new)datasourceCreateBehavior changes
A multi-statement query now fails when any statement fails. The message is "A statement in this query failed. Other statements in the query may already have run. ". Statements that already ran are not undone. An app whose success handler ran for such a query will now get its error handler.
affectedRowsis still the first statement's count.A bound time value is sent as
time. A time filter works. A bound time written into adatetimecolumn gets the date 1900-01-01, not 1970-01-01. Time-like text bound into avarcharcolumn is stored as13:45:30.0000000, notJan 1 1970 1:45PM.affectedRowsfor an insert that fires a trigger, with prepared statements off. It is now the insert's own count. Before, it was the trigger's count. For example, an insert of 1 row whose trigger writes 3 rows now reports 1, not 3. With prepared statements on (the default), it still reports 3. No driver setting restores the old value. A trigger withSET NOCOUNT ONhas no count of its own, so it is not affected.A host with
;,=,{,}or a control character is refused with "Invalid host: the host must not contain ';', '=', '{', '}' or control characters." A saved datasource with such a host now fails Test configuration and queries until the host is fixed.Test configuration fails faster. A wrong database, a refused port or an unknown host now fails in about 1 second, not about 30. An unreachable address fails in about 9 seconds, not about 31. The error messages are the same.
Everything else matched on both drivers: every column type, the other update counts, error messages, a query longer than 30 seconds, and a connection reused after sitting idle.
rowversionanddatetimeoffset(fixed in this PR)The column-type handling in
MssqlExecuteUtilsmatched Postgres type names, so on both drivers:rowversionfailed with "The conversion from timestamp to DATE is unsupported". SQL Server reports it astimestamp, and the plugin read the 8 bytes as a date. It now comes back as hex, such as0x0000000000000FA1, as SQL Server Management Studio shows it.datetimeoffsetfailed because the plugin returned the driver'sDateTimeOffsetobject, which the JSON mapper cannot write. It now comes back as ISO 8601 text that keeps the offset and every fractional digit, such as2024-02-29T13:45:30.1234567+05:30.Notes for reviewers and users:
Z, and trailing zeros in the fraction are dropped. For example,13:45:30.1200000 +00:00becomes2024-02-29T13:45:30.12Z.rowversionis hex, whilevarbinarystays base64.rowversionis a version token, and hex is how SQL Server shows it.rowversionback into a query, convert it. With prepared statements on, the value is sent as text, and SQL Server does not read text as hex. SoUPDATE … WHERE rv = {{Table1.selectedRow.rv}}never matches and silently updates 0 rows, with no error. This is the usual optimistic-locking pattern, where 0 rows normally means "someone else changed the row", so the mistake is easy to miss. UseWHERE rv = CONVERT(binary(8), {{Table1.selectedRow.rv}}, 1). This is not a regression, because the column could not be read before. It needs to go into the SQL Server page of the docs.datetimeoffsetvalue inside asql_variantcolumn still fails the query, before and after this PR. Asql_variantthat holds any other type works.Rollback
mssqlPlugin/pom.xml. That keeps the host check. On 11.2.4, with every other change in place, all tests pass except the trigger counts above. 11.2.4 acceptsvectorTypeSupport.Next
The "Enabled, verify certificate" SSL mode is the follow-up PR (APP-16551).
Automation
/ok-to-test tags="@tag.All"
Testing
Local runs (SQL Server 2022, Testcontainers, Java 25):
-Dmssql.test.image=…). The type snapshot also passes in UTC and in America/Los_Angeles.MssqlDataTypeMatrixTestpins about 60 type cases: a literal insert, a bound insert with prepared statements on and off, a read in both modes, and a bound filter in both modes. Results:src/test/resources/mssql-data-type-matrix.txt. The file is the same on 2019, 2022 and 2025.jsonandvectorwork. WithoutvectorTypeSupport=off,vectorcomes back as unreadable bytes, so the setting is needed.datetimeoffsetof 0001-01-01 comes back 2 days early, and 13.6.2 fixes that.MssqlExecuteUtils, the type snapshot fails with "The conversion from timestamp to DATE is unsupported".Deploy preview (https://ce-42639.dp.appsmith.com, built from 2112465) against Azure SQL (
Microsoft SQL Azure (RTM) - 12.0.2000.8, AdventureWorksLT):rowversionreturns0x0000000000000FA1, anddatetimeoffsetreturns2024-02-29T13:45:30.1234567+05:30. Offset 0 returns2024-02-29T13:45:30.12Z, andSYSDATETIMEOFFSET()returns a value.binary = {{"0x0000000000000FA1"}}gives no match, andbinary = CONVERT(binary(8), {{"0x0000000000000FA1"}}, 1)gives a match. This confirms the note above.Deploy preview (built from 3df0a34) against Azure SQL, round 2:
jsonandvector(3). Created, written with literals and with bindings, and read back with prepared statements on and off.time,date,datetimeoffset, lower-caseuniqueidentifier,nvarcharwith Japanese and emoji,datetime,bigintas text, androwversionwithCONVERT. All match.SQL Server 2019 now runs in the automated tests. The cases not yet run are listed in the test plan, section 11.
Suggested Cypress tags or specs:
@tag.Datasource(MsSQL_Basic_Spec, MsSQLDataSourceStub_spec, Port_Number_Placeholder_Spec)Communication
Should the DevRel and Marketing teams inform users about this change?
Release note: the SQL Server driver is upgraded. A query with several statements now fails when any statement fails, instead of reporting success. A bound time value can now filter a
timecolumn. Queries that returnrowversionordatetimeoffsetcolumns now work:rowversioncomes back as hex (0x…), anddatetimeoffsetas ISO 8601 text with its offset. With prepared statements off,affectedRowsfor an insert that fires a trigger now counts the insert's rows. Hosts containing;,=,{or}are refused. Asql_variantholding adatetimeoffsetnow works too.🤖 Generated with Claude Code
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/44195328704
Commit: 38fd1b8
Cypress dashboard.
Tags:
@tag.AllSpec:
Tue, 17 Nov 2026 23:40:40 UTC