public interface CommonDataSource
| javax.sql.CommonDataSource |
| |
接口,定义它们之间的共同的方法 DataSource , XADataSource和 ConnectionPoolDataSource 。
公共方法(Public methods) |
|
|---|---|
abstract PrintWriter |
getLogWriter() 检索此 |
abstract int |
getLoginTimeout() 获取此数据源在尝试连接到数据库时可以等待的最长时间(以秒为单位)。 |
abstract Logger |
getParentLogger() 返回此数据源使用的所有记录器的父记录器。 |
abstract void |
setLogWriter(PrintWriter out) 将此 |
abstract void |
setLoginTimeout(int seconds) 设置此数据源在尝试连接到数据库时将等待的最长时间(以秒为单位)。 |
PrintWriter getLogWriter ()
检索此 DataSource对象的日志 DataSource 。
日志记录器是一个字符输出流,将打印此数据源的所有日志记录和跟踪消息。 这包括由此对象的方法打印的消息,由此对象制造的其他对象的方法打印的消息等。 打印到数据源特定日志写入器的消息不会打印到与java.sql.DriverManager类相关的日志写入器。 当创建一个DataSource对象时,日志写入器最初为空; 换句话说,缺省值是记录被禁用。
| 返回(Returns) | |
|---|---|
PrintWriter |
the log writer for this data source or null if logging is disabled |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
int getLoginTimeout ()
获取此数据源在尝试连接到数据库时可以等待的最长时间(以秒为单位)。 值为零意味着超时是缺省系统超时(如果有); 否则,这意味着没有超时。 当创建DataSource对象时,登录超时最初为零。
| 返回(Returns) | |
|---|---|
int |
the data source login time limit |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs. |
也可以看看:
Logger getParentLogger ()
返回此数据源使用的所有记录器的父记录器。 这应该是远离根Logger的Logger,它仍然是此数据源使用的所有Logger的祖先。 配置此记录器将影响数据源生成的所有日志消息。 在最坏的情况下,这可能是根Logger。
| 返回(Returns) | |
|---|---|
Logger |
the parent Logger for this data source |
| 抛出异常(Throws) | |
|---|---|
SQLFeatureNotSupportedException |
if the data source does not use java.util.logging |
void setLogWriter (PrintWriter out)
将此 DataSource对象的日志 DataSource设置为给定的 java.io.PrintWriter对象。
日志记录器是一个字符输出流,将打印此数据源的所有日志记录和跟踪消息。 这包括由此对象的方法打印的消息,由此对象制造的其他对象的方法打印的消息等。 打印到数据源特定的日志写入器的消息不会打印到与java.sql.DriverManager类相关的日志写入器。 当创建DataSource对象时,日志写入器最初为空; 换句话说,缺省值是记录被禁用。
| 参数(Parameters) | |
|---|---|
out |
PrintWriter: the new log writer; to disable logging, set to null |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs |
也可以看看:
void setLoginTimeout (int seconds)
设置此数据源在尝试连接到数据库时将等待的最长时间(以秒为单位)。 值为零指定超时是缺省系统超时(如果有超时); 否则,它指定没有超时。 当创建一个DataSource对象时,登录超时最初为零。
| 参数(Parameters) | |
|---|---|
seconds |
int: the data source login time limit |
| 抛出异常(Throws) | |
|---|---|
SQLException |
if a database access error occurs. |
也可以看看: