@Override public CheckResult check() { try (Connection conn = datasource.getConnection()) { context.get(conn).select(ZIPKIN_SPANS.TRACE_ID).from(ZIPKIN_SPANS).limit(1).execute(); } catch (SQLException | RuntimeException e) { return CheckResult.failed(e); } return CheckResult.OK; }
static boolean test(DataSource datasource, DSLContexts context) { try (Connection conn = datasource.getConnection()) { DSLContext dsl = context.get(conn); dsl.select(ZIPKIN_DEPENDENCIES.ERROR_COUNT).from(ZIPKIN_DEPENDENCIES).limit(1).fetchAny(); return true; } catch (DataAccessException e) { if (e.sqlState().equals("42S22")) { LOG.warning("zipkin_dependencies.error_count doesn't exist, so DependencyLink.errorCount is not supported. " + "Execute: alter table zipkin_dependencies add `error_count` BIGINT"); return false; } problemReading(e); } catch (SQLException | RuntimeException e) { problemReading(e); } return false; }
static boolean test(DataSource datasource, DSLContexts context) { try (Connection conn = datasource.getConnection()) { DSLContext dsl = context.get(conn); dsl.select(ZIPKIN_ANNOTATIONS.ENDPOINT_IPV6).from(ZIPKIN_ANNOTATIONS).limit(1).fetchAny(); return true; } catch (DataAccessException e) { if (e.sqlState().equals("42S22")) { LOG.warning("zipkin_annotations.ipv6 doesn't exist, so Endpoint.ipv6 is not supported. " + "Execute: alter table zipkin_annotations add `endpoint_ipv6` BINARY(16)"); return false; } problemReading(e); } catch (SQLException | RuntimeException e) { problemReading(e); } return false; }
static boolean test(DataSource datasource, DSLContexts context) { try (Connection conn = datasource.getConnection()) { DSLContext dsl = context.get(conn); dsl.select(ZIPKIN_SPANS.TRACE_ID_HIGH).from(ZIPKIN_SPANS).limit(1).fetchAny(); return true; } catch (DataAccessException e) { if (e.sqlState().equals("42S22")) { LOG.warning(MESSAGE); return false; } problemReading(e); } catch (SQLException | RuntimeException e) { problemReading(e); } return false; }
private boolean is55() { // Check if this is a MySQL 5.5 or later database if (is55 == null) { try { create().selectOne().from(PARAMETERS).limit(1).fetchOne(); is55 = true; } catch (Exception e) { is55 = false; } } return is55; } }