Path: blob/master/src/java.sql/share/classes/javax/sql/ConnectionPoolDataSource.java
41152 views
/*1* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.sql;2627import java.sql.SQLException;28import java.sql.SQLFeatureNotSupportedException;293031/**32* A factory for {@code PooledConnection}33* objects. An object that implements this interface will typically be34* registered with a naming service that is based on the35* Java Naming and Directory Interface36* (JNDI).37*38* @since 1.439*/4041public interface ConnectionPoolDataSource extends CommonDataSource {4243/**44* Attempts to establish a physical database connection that can45* be used as a pooled connection.46*47* @return a {@code PooledConnection} object that is a physical48* connection to the database that this49* {@code ConnectionPoolDataSource} object represents50* @throws SQLException if a database access error occurs51* @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support52* this method53* @since 1.454*/55PooledConnection getPooledConnection() throws SQLException;5657/**58* Attempts to establish a physical database connection that can59* be used as a pooled connection.60*61* @param user the database user on whose behalf the connection is being made62* @param password the user's password63* @return a {@code PooledConnection} object that is a physical64* connection to the database that this65* {@code ConnectionPoolDataSource} object represents66* @throws SQLException if a database access error occurs67* @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support68* this method69* @since 1.470*/71PooledConnection getPooledConnection(String user, String password)72throws SQLException;7374/**75* {@inheritDoc}76* @since 1.477*/78@Override79java.io.PrintWriter getLogWriter() throws SQLException;8081/**82* {@inheritDoc}83* @since 1.484*/85@Override86void setLogWriter(java.io.PrintWriter out) throws SQLException;8788/**89* {@inheritDoc}90* @since 1.491*/92@Override93void setLoginTimeout(int seconds) throws SQLException;9495/**96* {@inheritDoc}97* @since 1.498*/99@Override100int getLoginTimeout() throws SQLException;101102//------------------------- JDBC 4.3 -----------------------------------103104/**105* Creates a new {@code PooledConnectionBuilder} instance106* @implSpec107* The default implementation will throw a {@code SQLFeatureNotSupportedException}.108* @return The ConnectionBuilder instance that was created109* @throws SQLException if an error occurs creating the builder110* @throws SQLFeatureNotSupportedException if the driver does not support sharding111* @since 9112* @see PooledConnectionBuilder113*/114default PooledConnectionBuilder createPooledConnectionBuilder() throws SQLException {115throw new SQLFeatureNotSupportedException("createPooledConnectionBuilder not implemented");116};117}118119120