老男孩Linux云計算微服務(wù)架構(gòu)師:K8s集群架構(gòu)
? ?/**
? ? * 不同數(shù)據(jù)源類型獲取數(shù)據(jù)庫連接
? ? */
? ?private DatabaseType createDatabaseType(final DataSource dataSource) throws SQLException {
? ? ? ?if (dataSource instanceof AbstractDataSourceAdapter) {
? ? ? ? ? ?return ((AbstractDataSourceAdapter) dataSource).databaseType;
? ? ? ?}
? ? ? ?try (Connection connection = dataSource.getConnection()) {
? ? ? ? ? ?return DatabaseTypes.getDatabaseTypeByURL(connection.getMetaData().getURL());
? ? ? ?}
? ?}
標簽: