Skip to content

Commit 5a5fb7d

Browse files
authored
Merge pull request #659 from findepi/findepi/return-proper-error-when-user-tries-to-enable-transactions-5e522f
Return proper error when user tries to enable transactions
2 parents 6320772 + d813994 commit 5a5fb7d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clickhouse-jdbc/src/main/java/ru/yandex/clickhouse/ClickHouseConnectionImpl.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ public String nativeSQL(String sql) throws SQLException {
209209

210210
@Override
211211
public void setAutoCommit(boolean autoCommit) throws SQLException {
212-
212+
if (autoCommit) {
213+
return;
214+
}
215+
throw new SQLFeatureNotSupportedException("Transactions are not supported");
213216
}
214217

215218
@Override
@@ -219,12 +222,12 @@ public boolean getAutoCommit() throws SQLException {
219222

220223
@Override
221224
public void commit() throws SQLException {
222-
225+
throw new SQLException("Cannot commit when auto-commit is enabled");
223226
}
224227

225228
@Override
226229
public void rollback() throws SQLException {
227-
230+
throw new SQLException("Cannot rollback when auto-commit is enabled");
228231
}
229232

230233
@Override

0 commit comments

Comments
 (0)