|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -39,6 +39,10 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource { |
|
|
|
|
|
|
|
|
|
|
|
private String password; |
|
|
|
private String password; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String catalog; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String schema; |
|
|
|
|
|
|
|
|
|
|
|
private Properties connectionProperties; |
|
|
|
private Properties connectionProperties; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -88,6 +92,40 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource { |
|
|
|
return this.password; |
|
|
|
return this.password; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Specify a database catalog to be applied to each Connection. |
|
|
|
|
|
|
|
* @since 4.3.2 |
|
|
|
|
|
|
|
* @see Connection#setCatalog |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setCatalog(String catalog) { |
|
|
|
|
|
|
|
this.catalog = catalog; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Return the database catalog to be applied to each Connection, if any. |
|
|
|
|
|
|
|
* @since 4.3.2 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public String getCatalog() { |
|
|
|
|
|
|
|
return this.catalog; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Specify a database schema to be applied to each Connection. |
|
|
|
|
|
|
|
* @since 4.3.2 |
|
|
|
|
|
|
|
* @see Connection#setSchema |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setSchema(String schema) { |
|
|
|
|
|
|
|
this.schema = schema; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Return the database schema to be applied to each Connection, if any. |
|
|
|
|
|
|
|
* @since 4.3.2 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public String getSchema() { |
|
|
|
|
|
|
|
return this.schema; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Specify arbitrary connection properties as key/value pairs, |
|
|
|
* Specify arbitrary connection properties as key/value pairs, |
|
|
|
* to be passed to the Driver. |
|
|
|
* to be passed to the Driver. |
|
|
|
@ -152,7 +190,15 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource { |
|
|
|
if (password != null) { |
|
|
|
if (password != null) { |
|
|
|
mergedProps.setProperty("password", password); |
|
|
|
mergedProps.setProperty("password", password); |
|
|
|
} |
|
|
|
} |
|
|
|
return getConnectionFromDriver(mergedProps); |
|
|
|
|
|
|
|
|
|
|
|
Connection con = getConnectionFromDriver(mergedProps); |
|
|
|
|
|
|
|
if (this.catalog != null) { |
|
|
|
|
|
|
|
con.setCatalog(this.catalog); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (this.schema != null) { |
|
|
|
|
|
|
|
con.setSchema(this.schema); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return con; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|