src/java.sql/share/classes/javax/sql/CommonDataSource.java

Print this page


   1 /*
   2  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.sql;
  27 
  28 import java.sql.SQLException;
  29 import java.io.PrintWriter;
  30 import java.sql.SQLFeatureNotSupportedException;

  31 import java.util.logging.Logger;
  32 
  33 /**
  34  * Interface that defines the methods which are common between <code>DataSource</code>,
  35  * <code>XADataSource</code> and <code>ConnectionPoolDataSource</code>.
  36  *
  37  * @since 1.6
  38  */
  39 public interface CommonDataSource {
  40 
  41     /**
  42      * <p>Retrieves the log writer for this <code>DataSource</code>
  43      * object.
  44      *
  45      * <p>The log writer is a character output stream to which all logging
  46      * and tracing messages for this data source will be
  47      * printed.  This includes messages printed by the methods of this
  48      * object, messages printed by methods of other objects manufactured
  49      * by this object, and so on.  Messages printed to a data source
  50      * specific log writer are not printed to the log writer associated


 111      * @see #setLoginTimeout
 112      * @since 1.4
 113      */
 114     int getLoginTimeout() throws SQLException;
 115 
 116     //------------------------- JDBC 4.1 -----------------------------------
 117 
 118     /**
 119      * Return the parent Logger of all the Loggers used by this data source. This
 120      * should be the Logger farthest from the root Logger that is
 121      * still an ancestor of all of the Loggers used by this data source. Configuring
 122      * this Logger will affect all of the log messages generated by the data source.
 123      * In the worst case, this may be the root Logger.
 124      *
 125      * @return the parent Logger for this data source
 126      * @throws SQLFeatureNotSupportedException if the data source does not use
 127      * {@code java.util.logging}
 128      * @since 1.7
 129      */
 130     public Logger getParentLogger() throws SQLFeatureNotSupportedException;
















 131 }
   1 /*
   2  * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.sql;
  27 
  28 import java.sql.SQLException;

  29 import java.sql.SQLFeatureNotSupportedException;
  30 import java.sql.ShardingKeyBuilder;
  31 import java.util.logging.Logger;
  32 
  33 /**
  34  * Interface that defines the methods which are common between <code>DataSource</code>,
  35  * <code>XADataSource</code> and <code>ConnectionPoolDataSource</code>.
  36  *
  37  * @since 1.6
  38  */
  39 public interface CommonDataSource {
  40 
  41     /**
  42      * <p>Retrieves the log writer for this <code>DataSource</code>
  43      * object.
  44      *
  45      * <p>The log writer is a character output stream to which all logging
  46      * and tracing messages for this data source will be
  47      * printed.  This includes messages printed by the methods of this
  48      * object, messages printed by methods of other objects manufactured
  49      * by this object, and so on.  Messages printed to a data source
  50      * specific log writer are not printed to the log writer associated


 111      * @see #setLoginTimeout
 112      * @since 1.4
 113      */
 114     int getLoginTimeout() throws SQLException;
 115 
 116     //------------------------- JDBC 4.1 -----------------------------------
 117 
 118     /**
 119      * Return the parent Logger of all the Loggers used by this data source. This
 120      * should be the Logger farthest from the root Logger that is
 121      * still an ancestor of all of the Loggers used by this data source. Configuring
 122      * this Logger will affect all of the log messages generated by the data source.
 123      * In the worst case, this may be the root Logger.
 124      *
 125      * @return the parent Logger for this data source
 126      * @throws SQLFeatureNotSupportedException if the data source does not use
 127      * {@code java.util.logging}
 128      * @since 1.7
 129      */
 130     public Logger getParentLogger() throws SQLFeatureNotSupportedException;
 131 
 132     //------------------------- JDBC 4.3 -----------------------------------
 133 
 134     /**
 135      * Creates a new {@code ShardingKeyBuilder} instance
 136      * @implSpec
 137      * The default implementation will throw a {@code SQLFeatureNotSupportedException}.
 138      * @return The ShardingKeyBuilder instance that was created
 139      * @throws SQLException if an error occurs creating the builder
 140      * @throws SQLFeatureNotSupportedException if the driver does not support this method
 141      * @since 9
 142      * @see ShardingKeyBuilder
 143     */
 144     default ShardingKeyBuilder createShardingKeyBuilder() throws SQLException {
 145         throw new SQLFeatureNotSupportedException("createShardingKeyBuilder not implemented");
 146   };
 147 }