Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/sql/CommonDataSource.java
38829 views
/*1* Copyright (c) 2005, 2013, 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.io.PrintWriter;29import java.sql.SQLFeatureNotSupportedException;30import java.util.logging.Logger;3132/**33* Interface that defines the methods which are common between <code>DataSource</code>,34* <code>XADataSource</code> and <code>ConnectionPoolDataSource</code>.35*36*/37public interface CommonDataSource {3839/**40* <p>Retrieves the log writer for this <code>DataSource</code>41* object.42*43* <p>The log writer is a character output stream to which all logging44* and tracing messages for this data source will be45* printed. This includes messages printed by the methods of this46* object, messages printed by methods of other objects manufactured47* by this object, and so on. Messages printed to a data source48* specific log writer are not printed to the log writer associated49* with the <code>java.sql.DriverManager</code> class. When a50* <code>DataSource</code> object is51* created, the log writer is initially null; in other words, the52* default is for logging to be disabled.53*54* @return the log writer for this data source or null if55* logging is disabled56* @exception java.sql.SQLException if a database access error occurs57* @see #setLogWriter58* @since 1.459*/60java.io.PrintWriter getLogWriter() throws SQLException;6162/**63* <p>Sets the log writer for this <code>DataSource</code>64* object to the given <code>java.io.PrintWriter</code> object.65*66* <p>The log writer is a character output stream to which all logging67* and tracing messages for this data source will be68* printed. This includes messages printed by the methods of this69* object, messages printed by methods of other objects manufactured70* by this object, and so on. Messages printed to a data source-71* specific log writer are not printed to the log writer associated72* with the <code>java.sql.DriverManager</code> class. When a73* <code>DataSource</code> object is created the log writer is74* initially null; in other words, the default is for logging to be75* disabled.76*77* @param out the new log writer; to disable logging, set to null78* @exception SQLException if a database access error occurs79* @see #getLogWriter80* @since 1.481*/82void setLogWriter(java.io.PrintWriter out) throws SQLException;8384/**85* <p>Sets the maximum time in seconds that this data source will wait86* while attempting to connect to a database. A value of zero87* specifies that the timeout is the default system timeout88* if there is one; otherwise, it specifies that there is no timeout.89* When a <code>DataSource</code> object is created, the login timeout is90* initially zero.91*92* @param seconds the data source login time limit93* @exception SQLException if a database access error occurs.94* @see #getLoginTimeout95* @since 1.496*/97void setLoginTimeout(int seconds) throws SQLException;9899/**100* Gets the maximum time in seconds that this data source can wait101* while attempting to connect to a database. A value of zero102* means that the timeout is the default system timeout103* if there is one; otherwise, it means that there is no timeout.104* When a <code>DataSource</code> object is created, the login timeout is105* initially zero.106*107* @return the data source login time limit108* @exception SQLException if a database access error occurs.109* @see #setLoginTimeout110* @since 1.4111*/112int getLoginTimeout() throws SQLException;113114//------------------------- JDBC 4.1 -----------------------------------115116/**117* Return the parent Logger of all the Loggers used by this data source. This118* should be the Logger farthest from the root Logger that is119* still an ancestor of all of the Loggers used by this data source. Configuring120* this Logger will affect all of the log messages generated by the data source.121* In the worst case, this may be the root Logger.122*123* @return the parent Logger for this data source124* @throws SQLFeatureNotSupportedException if the data source does not use125* {@code java.util.logging}126* @since 1.7127*/128public Logger getParentLogger() throws SQLFeatureNotSupportedException;129}130131132