📄 oracle.jdbc.pool.oracledatasource.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><!--NewPage--><html><head><!-- Generated by javadoc on Thu Dec 02 03:30:11 PST 1999 --><title> Class oracle.jdbc.pool.OracleDataSource</title></head><body><a name="_top_"></a><pre><a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-oracle.jdbc.pool.html">This Package</a> <a href="oracle.jdbc.pool.OracleConnectionPoolDataSource.html#_top_">Previous</a> <a href="oracle.jdbc.pool.OracleDataSourceFactory.html#_top_">Next</a> <a href="AllNames.html">Index</a></pre><hr><h1> Class oracle.jdbc.pool.OracleDataSource</h1><pre>java.lang.Object | +----oracle.jdbc.pool.OracleDataSource</pre><hr><dl> <dt> public class <b>OracleDataSource</b> <dt> extends Object <dt> implements Serializable</dl><p>A DataSource object is a factory for Connection objects. Anobject that implements the DataSource interface will typically beregistered with a JNDI service provider. A JDBC driver that isaccessed via the DataSource API does not automatically registeritself with the DriverManager.<p><hr><a name="index"></a><h2> <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index"></h2><dl> <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o "> <a href="#OracleDataSource()"><b>OracleDataSource</b></a>() <dd> </dl><h2> <img src="images/method-index.gif" width=207 height=38 alt="Method Index"></h2><dl> <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getConnection()"><b>getConnection</b></a>() <dd> <p>Attempt to establish a database connection. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getConnection(java.lang.String, java.lang.String)"><b>getConnection</b></a>(String, String) <dd> <p>Attempt to establish a database connection. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getDatabaseName()"><b>getDatabaseName</b></a>() <dd> Get the name of the database set on this DataSource instance. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getDataSourceName()"><b>getDataSourceName</b></a>() <dd> Get the datasource name for this instance if set. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getDescription()"><b>getDescription</b></a>() <dd> Get the Desciption of this data source. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getDriverType()"><b>getDriverType</b></a>() <dd> Get the Oracle JDBC driver type set for this datasource instance <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getLoginTimeout()"><b>getLoginTimeout</b></a>() <dd> u Gets the maximum time in seconds that this data source can waitwhile attempting to connect to a database. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getLogWriter()"><b>getLogWriter</b></a>() <dd> <p>Get the log writer for this data source. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getNetworkProtocol()"><b>getNetworkProtocol</b></a>() <dd> Get the network protocol set. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getPortNumber()"><b>getPortNumber</b></a>() <dd> Get the port number on which server is listening for requests. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getReference()"><b>getReference</b></a>() <dd> <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getServerName()"><b>getServerName</b></a>() <dd> Get the name of the server on which database is running. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getTNSEntryName()"><b>getTNSEntryName</b></a>() <dd> Get the TNS entry name for this instance if set. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getURL()"><b>getURL</b></a>() <dd> Get the URL for this datasource. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getUser()"><b>getUser</b></a>() <dd> Get the user name for this datasource. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setDatabaseName(java.lang.String)"><b>setDatabaseName</b></a>(String) <dd> Set the name of a particular database on a server. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setDataSourceName(java.lang.String)"><b>setDataSourceName</b></a>(String) <dd> Set the DataSourceName. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setDescription(java.lang.String)"><b>setDescription</b></a>(String) <dd> Set the Desciption for this data source instance. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setDriverType(java.lang.String)"><b>setDriverType</b></a>(String) <dd> Set the JDBC driver type. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setLoginTimeout(int)"><b>setLoginTimeout</b></a>(int) <dd> <p>Sets the maximum time in seconds that this data source will waitwhile attempting to connect to a database. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setLogWriter(java.io.PrintWriter)"><b>setLogWriter</b></a>(PrintWriter) <dd> <p>Set the log writer for this data source. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setNetworkProtocol(java.lang.String)"><b>setNetworkProtocol</b></a>(String) <dd> Set the network protocol for the connections. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setPassword(java.lang.String)"><b>setPassword</b></a>(String) <dd> Set the password with which connections have to be obtained. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setPortNumber(int)"><b>setPortNumber</b></a>(int) <dd> Set the port number where a server is listening for requests. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setServerName(java.lang.String)"><b>setServerName</b></a>(String) <dd> Set the name of the Server on which database is running. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setTNSEntryName(java.lang.String)"><b>setTNSEntryName</b></a>(String) <dd> Set the TNS entry name. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setURL(java.lang.String)"><b>setURL</b></a>(String) <dd> Set the URL from which connections have to be obtained. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setUser(java.lang.String)"><b>setUser</b></a>(String) <dd> Set the user name with which connections have to be obtained.</dl><a name="constructors"></a><h2> <img src="images/constructors.gif" width=231 height=38 alt="Constructors"></h2><a name="OracleDataSource"></a><a name="OracleDataSource()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a><b>OracleDataSource</b><pre> public OracleDataSource() throws SQLException</pre><a name="methods"></a><h2> <img src="images/methods.gif" width=151 height=38 alt="Methods"></h2><a name="getConnection()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getConnection"><b>getConnection</b></a><pre> public synchronized Connection getConnection() throws SQLException</pre><dl> <dd> <p>Attempt to establish a database connection.<p> <dd><dl> <dt> <b>Returns:</b> <dd> a Connection to the database <dt> <b>Throws:</b> SQLException <dd> if a database-access error occurs. </dl></dd></dl><a name="getConnection(java.lang.String, java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getConnection"><b>getConnection</b></a><pre> public synchronized Connection getConnection(String user, String passwd) throws SQLException</pre><dl> <dd> <p>Attempt to establish a database connection.<p> <dd><dl> <dt> <b>Parameters:</b> <dd> user - the database user on whose behalf the Connection isbeing made <dd> password - the user's password <dt> <b>Returns:</b> <dd> a Connection to the database <dt> <b>Throws:</b> SQLException <dd> if a database-access error occurs. </dl></dd></dl><a name="getLoginTimeout()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getLoginTimeout"><b>getLoginTimeout</b></a><pre> public synchronized int getLoginTimeout()</pre><dl> <dd> u Gets the maximum time in seconds that this data source can waitwhile attempting to connect to a database. A value of zeromeans that the timeout is the default system timeoutif there is one; otherwise it means that there is no timeout.When a DataSource object is created the login timeout isinitially zero.<p> <dd><dl> <dt> <b>Returns:</b> <dd> the data source login time limit <dt> <b>Throws:</b> SQLException <dd> if a database access error occurs. </dl></dd></dl><a name="setLoginTimeout(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setLoginTimeout"><b>setLoginTimeout</b></a><pre> public synchronized void setLoginTimeout(int timeout)</pre><dl> <dd> <p>Sets the maximum time in seconds that this data source will waitwhile attempting to connect to a database. A value of zerospecifies that the timeout is the default system timeoutif there is one; otherwise it specifies that there is no timeout.When a DataSource object is created the login timeout isinitially zero.<p> <dd><dl> <dt> <b>Parameters:</b> <dd> seconds - the data source login time limit <dt> <b>Throws:</b> SQLException <dd> if a database access error occurs. </dl></dd></dl><a name="setLogWriter(java.io.PrintWriter)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setLogWriter"><b>setLogWriter</b></a><pre> public synchronized void setLogWriter(PrintWriter pw)</pre><dl> <dd> <p>Set the log writer for this data source.<p>The log writer is a character output stream to which all loggingand tracing messages for this data source object instance will beprinted. This includes messages printed by the methods of thisobject, messages printed by methods of other objects manufacturedby this object, and so on. Messages printed to a data sourcespecific log writer are not printed to the log writer associatedwith the java.sql.Drivermanager class. When a DataSource object iscreated the log writer is initially null, in other words, loggingis disabled.<p> <dd><dl> <dt> <b>Parameters:</b> <dd> out - the new log writer; to disable, set to null <dt> <b>Throws:</b> SQLException <dd> if a database-access error occurs. </dl></dd></dl><a name="getLogWriter()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getLogWriter"><b>getLogWriter</b></a><pre> public synchronized PrintWriter getLogWriter()</pre><dl> <dd> <p>Get the log writer for this data source.<p>The log writer is a character output stream to which all loggingand tracing messages for this data source object instance will beprinted. This includes messages printed by the methods of thisobject, messages printed by methods of other objects manufacturedby this object, and so on. Messages printed to a data sourcespecific log writer are not printed to the log writer associatedwith the java.sql.Drivermanager class. When a DataSource object iscreated the log writer is initially null, in other words, loggingis disabled.<p> <dd><dl> <dt> <b>Returns:</b> <dd> the log writer for this data source, null if disabled <dt> <b>Throws:</b> SQLException <dd> if a database-access error occurs. </dl></dd></dl><a name="setTNSEntryName(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setTNSEntryName"><b>setTNSEntryName</b></a><pre> public synchronized void setTNSEntryName(String dbname)</pre><dl> <dd> Set the TNS entry name. Works only for JDBC OCI driver.Assumed that client side Oracle in installed andTNS_ADMIN env variable is set. If URL is set, this property will be ignored.<p><p> <dd><dl> <dt> <b>Parameters:</b> <dd> dbname - tns entry name </dl></dd></dl><a name="getTNSEntryName()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getTNSEntryName"><b>getTNSEntryName</b></a><pre>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -