Home | History | Annotate | Download | only in sql
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 package javax.sql;
     19 
     20 import java.io.PrintWriter;
     21 import java.sql.SQLException;
     22 
     23 /**
     24  * Interface that defines the methods which are common between DataSource,
     25  * XADataSource and ConnectionPoolDataSource.
     26  *
     27  * @since 1.6
     28  */
     29 public interface CommonDataSource {
     30 
     31     /**
     32      * While attempting to connect to a database, this method get the maximum
     33      * time in seconds that this data source can wait.
     34      *
     35      * @return An integer value to indicate the maximum time.
     36      * @throws SQLException
     37      *             An exception threw when a data base access error occurs.
     38      */
     39     public int getLoginTimeout() throws SQLException;
     40 
     41     /**
     42      * Retrieves a log writer which is a character output stream to which all
     43      * logging and tracing messages for this data source will be printed.
     44      *
     45      * @return The PrintWriter object for this DataSource.
     46      * @throws SQLException
     47      *             An exception threw when a data base access error occurs.
     48      */
     49     PrintWriter getLogWriter() throws SQLException;
     50 
     51     /**
     52      * While attempting to connect to a database, this method set the maximum
     53      * time in seconds that this data source can wait.
     54      *
     55      * @param seconds
     56      *            An integer value to indicate the maximum time.
     57      * @throws SQLException
     58      *             An exception threw when a data base access error occurs.
     59      */
     60     void setLoginTimeout(int seconds) throws SQLException;
     61 
     62     /**
     63      * Set a log writer which is a character output stream to which all logging
     64      * and tracing messages for this data source will be printed.
     65      *
     66      * @param out
     67      *            The PrintWriter object for this DataSource.
     68      * @throws SQLException
     69      */
     70     void setLogWriter(PrintWriter out) throws SQLException;
     71 }