/** * Create a new SingleConnectionDataSource with a given Connection. * @param target underlying target Connection * @param suppressClose if the Connection should be wrapped with a Connection that * suppresses {@code close()} calls (to allow for normal {@code close()} * usage in applications that expect a pooled Connection but do not know our * SmartDataSource interface) */ public SingleConnectionDataSource(Connection target, boolean suppressClose) { Assert.notNull(target, "Connection must not be null"); this.target = target; this.suppressClose = suppressClose; this.connection = (suppressClose ? getCloseSuppressingConnectionProxy(target) : target); }
/** * Initialize the underlying Connection via the DriverManager. */ public void initConnection() throws SQLException { if (getUrl() == null) { throw new IllegalStateException("'url' property is required for lazily initializing a Connection"); } synchronized (this.connectionMonitor) { closeConnection(); this.target = getConnectionFromDriver(getUsername(), getPassword()); prepareConnection(this.target); if (logger.isDebugEnabled()) { logger.debug("Established shared JDBC Connection: " + this.target); } this.connection = (isSuppressClose() ? getCloseSuppressingConnectionProxy(this.target) : this.target); } }
/** * Create a new SingleConnectionDataSource with a given Connection. * @param target underlying target Connection * @param suppressClose if the Connection should be wrapped with a Connection that * suppresses {@code close()} calls (to allow for normal {@code close()} * usage in applications that expect a pooled Connection but do not know our * SmartDataSource interface) */ public SingleConnectionDataSource(Connection target, boolean suppressClose) { Assert.notNull(target, "Connection must not be null"); this.target = target; this.suppressClose = suppressClose; this.connection = (suppressClose ? getCloseSuppressingConnectionProxy(target) : target); }
/** * Create a new SingleConnectionDataSource with a given Connection. * @param target underlying target Connection * @param suppressClose if the Connection should be wrapped with a Connection that * suppresses {@code close()} calls (to allow for normal {@code close()} * usage in applications that expect a pooled Connection but do not know our * SmartDataSource interface) */ public SingleConnectionDataSource(Connection target, boolean suppressClose) { Assert.notNull(target, "Connection must not be null"); this.target = target; this.suppressClose = suppressClose; this.connection = (suppressClose ? getCloseSuppressingConnectionProxy(target) : target); }
/** * Initialize the underlying Connection via the DriverManager. */ public void initConnection() throws SQLException { if (getUrl() == null) { throw new IllegalStateException("'url' property is required for lazily initializing a Connection"); } synchronized (this.connectionMonitor) { closeConnection(); this.target = getConnectionFromDriver(getUsername(), getPassword()); prepareConnection(this.target); if (logger.isInfoEnabled()) { logger.info("Established shared JDBC Connection: " + this.target); } this.connection = (isSuppressClose() ? getCloseSuppressingConnectionProxy(this.target) : this.target); } }
/** * Initialize the underlying Connection via the DriverManager. */ public void initConnection() throws SQLException { if (getUrl() == null) { throw new IllegalStateException("'url' property is required for lazily initializing a Connection"); } synchronized (this.connectionMonitor) { closeConnection(); this.target = getConnectionFromDriver(getUsername(), getPassword()); prepareConnection(this.target); if (logger.isDebugEnabled()) { logger.debug("Established shared JDBC Connection: " + this.target); } this.connection = (isSuppressClose() ? getCloseSuppressingConnectionProxy(this.target) : this.target); } }