@@ -63,7 +63,7 @@ public class BenchmarkBase {
6363 protected static Connection jdbcV2 = null ;
6464
6565 @ Setup (Level .Iteration )
66- public void setUpIteration () throws SQLException {
66+ public void setUpIteration () {
6767 LOGGER .info ("BenchmarkBase::setUpIteration" );
6868 clientV1 = getClientV1 ();
6969 clientV2 = getClientV2 ();
@@ -72,7 +72,7 @@ public void setUpIteration() throws SQLException {
7272 }
7373
7474 @ TearDown (Level .Iteration )
75- public void tearDownIteration () throws SQLException {
75+ public void tearDownIteration () {
7676 LOGGER .info ("BenchmarkBase::tearDownIteration" );
7777 if (clientV1 != null ) {
7878 clientV1 .close ();
@@ -83,11 +83,19 @@ public void tearDownIteration() throws SQLException {
8383 clientV2 = null ;
8484 }
8585 if (jdbcV1 != null ) {
86- jdbcV1 .close ();
86+ try {
87+ jdbcV1 .close ();
88+ } catch (SQLException e ) {
89+ LOGGER .error (e .getMessage ());
90+ }
8791 jdbcV1 = null ;
8892 }
8993 if (jdbcV2 != null ) {
90- jdbcV2 .close ();
94+ try {
95+ jdbcV2 .close ();
96+ } catch (SQLException e ) {
97+ LOGGER .error (e .getMessage ());
98+ }
9199 jdbcV2 = null ;
92100 }
93101 }
@@ -258,26 +266,36 @@ protected static Client getClientV2(boolean includeDb) {
258266 .build ();
259267 }
260268
261- protected static Connection getJdbcV1 () throws SQLException {
269+ protected static Connection getJdbcV1 () {
262270 Properties properties = new Properties ();
263271 properties .put ("user" , getUsername ());
264272 properties .put ("password" , getPassword ());
265273
266274 ClickHouseNode node = getServer ();
267- LOGGER .info (String .format ("clickhouse endpoint [%s:%s]" , node .getHost (), node .getPort ()));
268- Connection jdbcV1 = new ClickHouseDriver ().connect (String .format ("jdbc:clickhouse://%s:%s?clickhouse.jdbc.v1=true" , node .getHost (), node .getPort ()), properties );
275+ LOGGER .info ("clickhouse endpoint [{}:{}]" , node .getHost (), node .getPort ());
276+ Connection jdbcV1 = null ;
277+ try {
278+ jdbcV1 = new ClickHouseDriver ().connect (String .format ("jdbc:clickhouse://%s:%s?clickhouse.jdbc.v1=true" , node .getHost (), node .getPort ()), properties );
279+ } catch (SQLException e ) {
280+ LOGGER .error (e .getMessage ());
281+ }
269282 return jdbcV1 ;
270283 }
271-
272- protected static Connection getJdbcV2 () throws SQLException {
284+
285+ protected static Connection getJdbcV2 () {
273286 Properties properties = new Properties ();
274287 properties .put ("user" , getUsername ());
275288 properties .put ("password" , getPassword ());
276289
277290 ClickHouseNode node = getServer ();
278- LOGGER .info (String . format ( "clickhouse endpoint [%s:%s ]" , node .getHost (), node .getPort () ));
291+ LOGGER .info ("clickhouse endpoint [{}:{} ]" , node .getHost (), node .getPort ());
279292
280- Connection jdbcV2 = new ClickHouseDriver ().connect (String .format ("jdbc:clickhouse://%s:%s" , node .getHost (), node .getPort ()), properties );
293+ Connection jdbcV2 = null ;
294+ try {
295+ jdbcV2 = new ClickHouseDriver ().connect (String .format ("jdbc:clickhouse://%s:%s" , node .getHost (), node .getPort ()), properties );
296+ } catch (SQLException e ) {
297+ LOGGER .error (e .getMessage ());
298+ }
281299 return jdbcV2 ;
282300 }
283301
0 commit comments