Revision a7aba938
Added by Andreas Kohlbecker over 6 years ago
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/opt/config/DataSourceConfigurer.java | ||
---|---|---|
110 | 110 |
protected static String beanDefinitionFile = DATASOURCE_BEANDEF_DEFAULT; |
111 | 111 |
|
112 | 112 |
|
113 |
private String cmdServerInstanceName = null; |
|
114 |
|
|
115 | 113 |
/** |
116 | 114 |
* The file to load the {@link DataSource} beans from. |
117 | 115 |
* This file is usually {@code ./.cdmLibrary/datasources.xml} |
... | ... | |
158 | 156 |
} |
159 | 157 |
|
160 | 158 |
// validate correct schema version |
159 |
Connection connection = null; |
|
161 | 160 |
try { |
162 | 161 |
|
163 |
Connection connection = dataSource.getConnection();
|
|
162 |
connection = dataSource.getConnection(); |
|
164 | 163 |
String metadataTableName = "CdmMetaData"; |
165 | 164 |
if(inferHibernateDialectName(dataSource).equals(H2CorrectedDialect.class.getName())){ |
166 | 165 |
metadataTableName = metadataTableName.toUpperCase(); |
... | ... | |
206 | 205 |
RuntimeException re = new RuntimeException("Unable to connect or to retrieve version info from data source " + dataSource.toString() , e); |
207 | 206 |
addErrorMessageToServletContextAttributes(re.getMessage()); |
208 | 207 |
throw re; |
209 |
|
|
208 |
} finally { |
|
209 |
if(connection != null){ |
|
210 |
try { |
|
211 |
connection.close(); |
|
212 |
} catch (SQLException e) { |
|
213 |
// IGNORE // |
|
214 |
} |
|
215 |
} |
|
210 | 216 |
} |
211 | 217 |
|
212 | 218 |
|
... | ... | |
217 | 223 |
CdmUpdater updater = CdmUpdater.NewInstance(); |
218 | 224 |
WrappedCdmDataSource cdmDataSource = new WrappedCdmDataSource(dataSource); |
219 | 225 |
updater.updateToCurrentVersion(cdmDataSource, null); |
226 |
cdmDataSource.closeOpenConnections(); |
|
220 | 227 |
} |
221 | 228 |
|
222 | 229 |
return dataSource; |
Also available in: Unified diff
ref #7034 closing open database connections in DataSourceConfigurer