9 |
9 |
|
10 |
10 |
package eu.etaxonomy.cdm.database;
|
11 |
11 |
|
|
12 |
import java.io.PrintWriter;
|
12 |
13 |
import java.sql.Connection;
|
13 |
14 |
import java.sql.DatabaseMetaData;
|
14 |
15 |
import java.sql.DriverManager;
|
... | ... | |
28 |
29 |
abstract class CdmDataSourceBase implements ICdmDataSource {
|
29 |
30 |
private static final Logger logger = Logger.getLogger(CdmDataSourceBase.class);
|
30 |
31 |
|
31 |
|
// private static final int TIMEOUT = 10;
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
// private static final int TIMEOUT = 10;
|
32 |
37 |
private Connection connection;
|
33 |
38 |
|
34 |
39 |
|
... | ... | |
230 |
235 |
logger.error("Error closing the connection");
|
231 |
236 |
}
|
232 |
237 |
}
|
|
238 |
|
|
239 |
// ************ javax.sql.DataSource base interfaces ********************/
|
|
240 |
|
|
241 |
|
|
242 |
@Override
|
|
243 |
public PrintWriter getLogWriter() throws SQLException {
|
|
244 |
//implementations copied from org.springframework.jdbc.datasource.AbstractDataSource;
|
|
245 |
throw new UnsupportedOperationException("getLogWriter");
|
|
246 |
}
|
|
247 |
|
|
248 |
|
|
249 |
@Override
|
|
250 |
public void setLogWriter(PrintWriter out) throws SQLException {
|
|
251 |
//implementations copied from org.springframework.jdbc.datasource.AbstractDataSource;
|
|
252 |
throw new UnsupportedOperationException("setLogWriter");
|
|
253 |
}
|
|
254 |
|
|
255 |
|
|
256 |
@Override
|
|
257 |
public void setLoginTimeout(int seconds) throws SQLException {
|
|
258 |
//implementations copied from org.springframework.jdbc.datasource.AbstractDataSource;
|
|
259 |
throw new UnsupportedOperationException("setLoginTimeout");
|
|
260 |
}
|
|
261 |
|
|
262 |
|
|
263 |
@Override
|
|
264 |
public int getLoginTimeout() throws SQLException {
|
|
265 |
//implementations copied from org.springframework.jdbc.datasource.AbstractDataSource;
|
|
266 |
return 0;
|
|
267 |
}
|
|
268 |
|
|
269 |
|
|
270 |
/*
|
|
271 |
* This is a preliminary implementation to be compliant with
|
|
272 |
* java.sql.Datasource (1.6). It may not be fully working.
|
|
273 |
* Please let the developers know if this doesn't work.
|
|
274 |
*/
|
|
275 |
|
|
276 |
//---------------------------------------------------------------------
|
|
277 |
// Implementation of JDBC 4.0's Wrapper interface
|
|
278 |
//---------------------------------------------------------------------
|
|
279 |
|
|
280 |
@SuppressWarnings("unchecked")
|
|
281 |
public <T> T unwrap(Class<T> iface) throws SQLException {
|
|
282 |
if (iface.isInstance(this)) {
|
|
283 |
return (T) this;
|
|
284 |
}
|
|
285 |
throw new SQLException("DataSource of type [" + getClass().getName() +
|
|
286 |
"] cannot be unwrapped as [" + iface.getName() + "]");
|
|
287 |
}
|
|
288 |
|
|
289 |
public boolean isWrapperFor(Class<?> iface) throws SQLException {
|
|
290 |
return iface.isInstance(this);
|
|
291 |
}
|
|
292 |
|
|
293 |
//
|
|
294 |
// //---------------------------------------------------------------------
|
|
295 |
// // Implementation of JDBC 4.1's getParentLogger method
|
|
296 |
// //---------------------------------------------------------------------
|
|
297 |
//
|
|
298 |
// public Logger getParentLogger() {
|
|
299 |
// return Logger.getLogger(java.util.logging.Logger.GLOBAL_LOGGER_NAME);
|
|
300 |
// }
|
|
301 |
|
233 |
302 |
}
|
let ICdmDataSource implement javax.sql.DataSource #3910