diff --git a/src/main/java/org/tarantool/jdbc/SQLConnection.java b/src/main/java/org/tarantool/jdbc/SQLConnection.java index 3f299151..15333871 100644 --- a/src/main/java/org/tarantool/jdbc/SQLConnection.java +++ b/src/main/java/org/tarantool/jdbc/SQLConnection.java @@ -479,13 +479,13 @@ private void throwUnknownClientProperties(Collection properties) throws @Override public String getClientInfo(String name) throws SQLException { checkNotClosed(); - throw new SQLFeatureNotSupportedException(); + return null; } @Override public Properties getClientInfo() throws SQLException { checkNotClosed(); - throw new SQLFeatureNotSupportedException(); + return new Properties(); } @Override diff --git a/src/test/java/org/tarantool/jdbc/JdbcConnectionIT.java b/src/test/java/org/tarantool/jdbc/JdbcConnectionIT.java index 9448a8c9..eca60d0d 100644 --- a/src/test/java/org/tarantool/jdbc/JdbcConnectionIT.java +++ b/src/test/java/org/tarantool/jdbc/JdbcConnectionIT.java @@ -17,14 +17,17 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.function.Executable; +import java.sql.ClientInfoStatus; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLClientInfoException; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; import java.sql.Statement; +import java.util.Map; public class JdbcConnectionIT { @@ -443,4 +446,19 @@ public void testGeneratedKeys() throws SQLException { ); } + @Test + void testSetClientInfoProperties() { + String targetProperty = "ApplicationName"; + + SQLClientInfoException exception = assertThrows( + SQLClientInfoException.class, + () -> conn.setClientInfo(targetProperty, "TestApp") + ); + + Map failedProperties = exception.getFailedProperties(); + assertEquals(1, failedProperties.size()); + assertEquals(ClientInfoStatus.REASON_UNKNOWN_PROPERTY, failedProperties.get(targetProperty)); + } + } + diff --git a/src/test/java/org/tarantool/jdbc/JdbcDatabaseMetaDataIT.java b/src/test/java/org/tarantool/jdbc/JdbcDatabaseMetaDataIT.java index d4ea9f2b..28477a0b 100644 --- a/src/test/java/org/tarantool/jdbc/JdbcDatabaseMetaDataIT.java +++ b/src/test/java/org/tarantool/jdbc/JdbcDatabaseMetaDataIT.java @@ -75,6 +75,14 @@ public void tearDownTest() throws SQLException { testHelper.executeSql(CLEAN_SQL); } + @Test + public void testGetSupportedClientInfo() throws SQLException { + ResultSet rs = meta.getClientInfoProperties(); + assertNotNull(rs); + assertFalse(rs.next()); + rs.close(); + } + @Test public void testGetTableTypes() throws SQLException { ResultSet rs = meta.getTableTypes();