From 2bb4df79c31c07e58506de8a95eb0330c6bd0113 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sun, 12 Jan 2025 18:08:54 +0100 Subject: [PATCH] Ignore SQLServerException with "not supported" message Closes gh-34233 --- .../jdbc/datasource/JdbcTransactionObjectSupport.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/JdbcTransactionObjectSupport.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/JdbcTransactionObjectSupport.java index 49421e52fc..aaa09e3a69 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/JdbcTransactionObjectSupport.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/JdbcTransactionObjectSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -183,6 +183,13 @@ public abstract class JdbcTransactionObjectSupport implements SavepointManager, catch (SQLFeatureNotSupportedException ex) { // typically on Oracle - ignore } + catch (SQLException ex) { + // ignore Microsoft SQLServerException: This operation is not supported. + String msg = ex.getMessage(); + if (msg == null || !msg.contains("not supported")) { + throw new TransactionSystemException("Could not explicitly release JDBC savepoint", ex); + } + } catch (Throwable ex) { throw new TransactionSystemException("Could not explicitly release JDBC savepoint", ex); }