老男孩Linux云計(jì)算微服務(wù)架構(gòu)師:K8s集群架構(gòu)
2022-11-24 21:13 作者:三國(guó)盡歸許佳琪 | 我要投稿
? ?/**
? ? * 不同數(shù)據(jù)源類型獲取數(shù)據(jù)庫(kù)連接
? ? */
? ?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());
? ? ? ?}
? ?}
標(biāo)簽: