src/share/classes/java/sql/DriverManager.java

Print this page




 395      *
 396      * @return the driver login time limit in seconds
 397      * @see #setLoginTimeout
 398      */
 399     public static int getLoginTimeout() {
 400         return (loginTimeout);
 401     }
 402 
 403     /**
 404      * Sets the logging/tracing PrintStream that is used
 405      * by the <code>DriverManager</code>
 406      * and all drivers.
 407      *<P>
 408      * In the Java 2 SDK, Standard Edition, version 1.3 release, this method checks
 409      * to see that there is an <code>SQLPermission</code> object before setting
 410      * the logging stream.  If a <code>SecurityManager</code> exists and its
 411      * <code>checkPermission</code> method denies setting the log writer, this
 412      * method throws a <code>java.lang.SecurityException</code>.
 413      *
 414      * @param out the new logging/tracing PrintStream; to disable, set to <code>null</code>
 415      * @deprecated
 416      * @throws SecurityException if a security manager exists and its
 417      *    <code>checkPermission</code> method denies setting the log stream
 418      *
 419      * @see SecurityManager#checkPermission
 420      * @see #getLogStream
 421      */

 422     public static void setLogStream(java.io.PrintStream out) {
 423 
 424         SecurityManager sec = System.getSecurityManager();
 425         if (sec != null) {
 426             sec.checkPermission(SET_LOG_PERMISSION);
 427         }
 428 
 429         logStream = out;
 430         if ( out != null )
 431             logWriter = new java.io.PrintWriter(out);
 432         else
 433             logWriter = null;
 434     }
 435 
 436     /**
 437      * Retrieves the logging/tracing PrintStream that is used by the <code>DriverManager</code>
 438      * and all drivers.
 439      *
 440      * @return the logging/tracing PrintStream; if disabled, is <code>null</code>
 441      * @deprecated
 442      * @see #setLogStream
 443      */

 444     public static java.io.PrintStream getLogStream() {
 445         return logStream;
 446     }
 447 
 448     /**
 449      * Prints a message to the current JDBC log stream.
 450      *
 451      * @param message a log or tracing message
 452      */
 453     public static void println(String message) {
 454         synchronized (logSync) {
 455             if (logWriter != null) {
 456                 logWriter.println(message);
 457 
 458                 // automatic flushing is never enabled, so we must do it ourselves
 459                 logWriter.flush();
 460             }
 461         }
 462     }
 463 




 395      *
 396      * @return the driver login time limit in seconds
 397      * @see #setLoginTimeout
 398      */
 399     public static int getLoginTimeout() {
 400         return (loginTimeout);
 401     }
 402 
 403     /**
 404      * Sets the logging/tracing PrintStream that is used
 405      * by the <code>DriverManager</code>
 406      * and all drivers.
 407      *<P>
 408      * In the Java 2 SDK, Standard Edition, version 1.3 release, this method checks
 409      * to see that there is an <code>SQLPermission</code> object before setting
 410      * the logging stream.  If a <code>SecurityManager</code> exists and its
 411      * <code>checkPermission</code> method denies setting the log writer, this
 412      * method throws a <code>java.lang.SecurityException</code>.
 413      *
 414      * @param out the new logging/tracing PrintStream; to disable, set to <code>null</code>
 415      * @deprecated Use {@code setLogWriter)
 416      * @throws SecurityException if a security manager exists and its
 417      *    <code>checkPermission</code> method denies setting the log stream
 418      *
 419      * @see SecurityManager#checkPermission
 420      * @see #getLogStream
 421      */
 422     @Deprecated
 423     public static void setLogStream(java.io.PrintStream out) {
 424 
 425         SecurityManager sec = System.getSecurityManager();
 426         if (sec != null) {
 427             sec.checkPermission(SET_LOG_PERMISSION);
 428         }
 429 
 430         logStream = out;
 431         if ( out != null )
 432             logWriter = new java.io.PrintWriter(out);
 433         else
 434             logWriter = null;
 435     }
 436 
 437     /**
 438      * Retrieves the logging/tracing PrintStream that is used by the <code>DriverManager</code>
 439      * and all drivers.
 440      *
 441      * @return the logging/tracing PrintStream; if disabled, is <code>null</code>
 442      * @deprecated  Use {@code getLogWriter)
 443      * @see #setLogStream
 444      */
 445     @Deprecated
 446     public static java.io.PrintStream getLogStream() {
 447         return logStream;
 448     }
 449 
 450     /**
 451      * Prints a message to the current JDBC log stream.
 452      *
 453      * @param message a log or tracing message
 454      */
 455     public static void println(String message) {
 456         synchronized (logSync) {
 457             if (logWriter != null) {
 458                 logWriter.println(message);
 459 
 460                 // automatic flushing is never enabled, so we must do it ourselves
 461                 logWriter.flush();
 462             }
 463         }
 464     }
 465