2424import static java .sql .RowIdLifetime .ROWID_UNSUPPORTED ;
2525import static java .util .Arrays .asList ;
2626import static java .util .Collections .singletonList ;
27- import static org .apache .ignite .internal .jdbc .JdbcDatabaseMetadataUtils .createObjectListResultSet ;
27+ import static org .apache .ignite .internal .jdbc .JdbcUtils .createObjectListResultSet ;
2828import static org .apache .ignite .internal .jdbc .proto .SqlStateCode .CONNECTION_CLOSED ;
2929
3030import java .sql .Connection ;
3333import java .sql .RowIdLifetime ;
3434import java .sql .SQLException ;
3535import java .sql .Types ;
36+ import java .time .ZoneId ;
3637import java .util .ArrayList ;
3738import java .util .LinkedList ;
3839import java .util .List ;
3940import java .util .concurrent .CancellationException ;
4041import java .util .concurrent .ExecutionException ;
42+ import java .util .function .Supplier ;
4143import org .apache .ignite .internal .client .proto .ProtocolVersion ;
4244import org .apache .ignite .internal .jdbc .proto .IgniteQueryErrorCode ;
4345import org .apache .ignite .internal .jdbc .proto .JdbcQueryEventHandler ;
@@ -85,24 +87,29 @@ public class JdbcDatabaseMetadata implements DatabaseMetaData {
8587
8688 private final Connection connection ;
8789
90+ private final Supplier <ZoneId > timeZoneSupplier ;
91+
8892 /**
8993 * Constructor.
9094 *
9195 * @param connection Connection
9296 * @param handler Handler.
9397 * @param url URL
9498 * @param userName User name,
99+ * @param timeZoneSupplier Time zone supplier.
95100 */
96101 public JdbcDatabaseMetadata (
97102 Connection connection ,
98103 JdbcQueryEventHandler handler ,
99104 String url ,
100- String userName
105+ String userName ,
106+ Supplier <ZoneId > timeZoneSupplier
101107 ) {
102108 this .handler = handler ;
103109 this .connection = connection ;
104110 this .url = url ;
105111 this .userName = userName ;
112+ this .timeZoneSupplier = timeZoneSupplier ;
106113 }
107114
108115 /** {@inheritDoc} */
@@ -913,7 +920,7 @@ public ResultSet getTables(String catalog, String schemaPtrn, String tblNamePtrn
913920 rows .add (tableRow (tblMeta ));
914921 }
915922
916- return createObjectListResultSet (rows , meta );
923+ return createObjectListResultSet (rows , meta , timeZoneSupplier );
917924 } catch (InterruptedException e ) {
918925 throw new SQLException ("Thread was interrupted." , e );
919926 } catch (ExecutionException e ) {
@@ -961,7 +968,7 @@ public ResultSet getSchemas(String catalog, String schemaPtrn) throws SQLExcepti
961968 rows .add (row );
962969 }
963970
964- return createObjectListResultSet (rows , meta );
971+ return createObjectListResultSet (rows , meta , timeZoneSupplier );
965972 } catch (InterruptedException e ) {
966973 throw new SQLException ("Thread was interrupted." , e );
967974 } catch (ExecutionException e ) {
@@ -978,7 +985,7 @@ public ResultSet getCatalogs() throws SQLException {
978985 ensureNotClosed ();
979986
980987 return createObjectListResultSet (singletonList (singletonList (CATALOG_NAME )),
981- asList (columnMeta ("TABLE_CAT" , ColumnType .STRING )));
988+ asList (columnMeta ("TABLE_CAT" , ColumnType .STRING )), timeZoneSupplier );
982989 }
983990
984991 /** {@inheritDoc} */
@@ -989,7 +996,7 @@ public ResultSet getTableTypes() throws SQLException {
989996
990997 return createObjectListResultSet (
991998 asList (List .of (TYPE_TABLE , TYPE_VIEW )),
992- asList (columnMeta ("TABLE_TYPE" , ColumnType .STRING )));
999+ asList (columnMeta ("TABLE_TYPE" , ColumnType .STRING )), timeZoneSupplier );
9931000 }
9941001
9951002 /** {@inheritDoc} */
@@ -1042,7 +1049,7 @@ public ResultSet getColumns(String catalog, String schemaPtrn, String tblNamePtr
10421049 rows .add (columnRow (res .meta ().get (i ), i + 1 ));
10431050 }
10441051
1045- return createObjectListResultSet (rows , meta );
1052+ return createObjectListResultSet (rows , meta , timeZoneSupplier );
10461053 } catch (InterruptedException e ) {
10471054 throw new SQLException ("Thread was interrupted." , e );
10481055 } catch (ExecutionException e ) {
@@ -1150,7 +1157,7 @@ public ResultSet getPrimaryKeys(String catalog, String schema, String tbl) throw
11501157 rows .addAll (primaryKeyRows (pkMeta ));
11511158 }
11521159
1153- return createObjectListResultSet (rows , meta );
1160+ return createObjectListResultSet (rows , meta , timeZoneSupplier );
11541161 } catch (InterruptedException e ) {
11551162 throw new SQLException ("Thread was interrupted." , e );
11561163 } catch (ExecutionException e ) {
@@ -1346,7 +1353,7 @@ public ResultSet getTypeInfo() throws SQLException {
13461353 columnMeta ("SQL_DATA_TYPE" , ColumnType .INT32 ),
13471354 columnMeta ("SQL_DATETIME_SUB" , ColumnType .INT32 ),
13481355 columnMeta ("NUM_PREC_RADIX" , ColumnType .INT32 )
1349- ));
1356+ ), timeZoneSupplier );
13501357 }
13511358
13521359 /** {@inheritDoc} */
@@ -1631,7 +1638,7 @@ public boolean autoCommitFailureClosesAllResultSets() {
16311638
16321639 /** {@inheritDoc} */
16331640 @ Override
1634- public ResultSet getClientInfoProperties () throws SQLException {
1641+ public ResultSet getClientInfoProperties () {
16351642 // We do not check whether connection is closed as
16361643 // this operation is not expected to do any server calls.
16371644 return createObjectListResultSet (asList (
0 commit comments