ConnectionPoolDataSource
Stay organized with collections
Save and categorize content based on your preferences.
A factory for PooledConnection
objects. An object that implements this interface will typically be
registered with a naming service that is based on the
JavaTM Naming and Directory Interface
(JNDI).
Inherited Method Summary
From interface
javax.sql.CommonDataSource
abstract
PrintWriter
|
getLogWriter()
Retrieves the log writer for this DataSource
object.
|
abstract
int
|
getLoginTimeout()
Gets the maximum time in seconds that this data source can wait
while attempting to connect to a database.
|
abstract
Logger
|
getParentLogger()
Return the parent Logger of all the Loggers used by this data source.
|
abstract
void
|
setLogWriter( PrintWriter out)
Sets the log writer for this DataSource
object to the given java.io.PrintWriter object.
|
abstract
void
|
setLoginTimeout(int seconds)
Sets the maximum time in seconds that this data source will wait
while attempting to connect to a database.
|
Public Methods
public
abstract
PooledConnection
getPooledConnection
()
Attempts to establish a physical database connection that can
be used as a pooled connection.
Returns
- a
PooledConnection
object that is a physical
connection to the database that this
ConnectionPoolDataSource
object represents
Throws
SQLException |
if a database access error occurs |
|
if the JDBC driver does not support
this method |
Attempts to establish a physical database connection that can
be used as a pooled connection.
Parameters
user |
the database user on whose behalf the connection is being made |
password |
the user's password |
Returns
- a
PooledConnection
object that is a physical
connection to the database that this
ConnectionPoolDataSource
object represents
Throws
SQLException |
if a database access error occurs |
|
if the JDBC driver does not support
this method |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eConnectionPoolDataSource\u003c/code\u003e is a factory for creating \u003ccode\u003ePooledConnection\u003c/code\u003e objects, used for managing physical database connections in a pool.\u003c/p\u003e\n"],["\u003cp\u003eIt's typically registered with a JNDI naming service for easy lookup and access.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetPooledConnection()\u003c/code\u003e methods establish physical database connections that can be used as pooled connections.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits methods from \u003ccode\u003eCommonDataSource\u003c/code\u003e for managing logging and login timeout.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eConnectionPoolDataSource\u003c/code\u003e is part of the JDBC API and facilitates connection pooling for efficient database interactions.\u003c/p\u003e\n"]]],[],null,["# ConnectionPoolDataSource\n\npublic interface **ConnectionPoolDataSource** implements [CommonDataSource](../../../reference/javax/sql/CommonDataSource.html) \nA factory for `PooledConnection`\nobjects. An object that implements this interface will typically be\nregistered with a naming service that is based on the\nJava^TM^ Naming and Directory Interface\n(JNDI). \n\n### Public Method Summary\n\n|---------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [PooledConnection](../../../reference/javax/sql/PooledConnection.html) | [getPooledConnection](../../../reference/javax/sql/ConnectionPoolDataSource.html#getPooledConnection())() Attempts to establish a physical database connection that can be used as a pooled connection. |\n| abstract [PooledConnection](../../../reference/javax/sql/PooledConnection.html) | [getPooledConnection](../../../reference/javax/sql/ConnectionPoolDataSource.html#getPooledConnection(java.lang.String,%20java.lang.String))([String](../../../reference/java/lang/String.html) user, [String](../../../reference/java/lang/String.html) password) Attempts to establish a physical database connection that can be used as a pooled connection. |\n\n### Inherited Method Summary\n\nFrom interface [javax.sql.CommonDataSource](../../../reference/javax/sql/CommonDataSource.html) \n\n|---------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [PrintWriter](../../../reference/java/io/PrintWriter.html) | [getLogWriter](../../../reference/javax/sql/CommonDataSource.html#getLogWriter())() Retrieves the log writer for this `DataSource` object. |\n| abstract int | [getLoginTimeout](../../../reference/javax/sql/CommonDataSource.html#getLoginTimeout())() Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. |\n| abstract [Logger](../../../reference/java/util/logging/Logger.html) | [getParentLogger](../../../reference/javax/sql/CommonDataSource.html#getParentLogger())() Return the parent Logger of all the Loggers used by this data source. |\n| abstract void | [setLogWriter](../../../reference/javax/sql/CommonDataSource.html#setLogWriter(java.io.PrintWriter))([PrintWriter](../../../reference/java/io/PrintWriter.html) out) Sets the log writer for this `DataSource` object to the given `java.io.PrintWriter` object. |\n| abstract void | [setLoginTimeout](../../../reference/javax/sql/CommonDataSource.html#setLoginTimeout(int))(int seconds) Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. |\n\nPublic Methods\n--------------\n\n#### public abstract [PooledConnection](../../../reference/javax/sql/PooledConnection.html)\n**getPooledConnection**\n()\n\nAttempts to establish a physical database connection that can\nbe used as a pooled connection. \n\n##### Returns\n\n- a `PooledConnection` object that is a physical connection to the database that this `ConnectionPoolDataSource` object represents \n\n##### Throws\n\n| [SQLException](../../../reference/java/sql/SQLException.html) | if a database access error occurs |\n| | if the JDBC driver does not support this method |\n|---------------------------------------------------------------|-------------------------------------------------|\n\n#### public abstract [PooledConnection](../../../reference/javax/sql/PooledConnection.html)\n**getPooledConnection**\n([String](../../../reference/java/lang/String.html) user, [String](../../../reference/java/lang/String.html) password)\n\nAttempts to establish a physical database connection that can\nbe used as a pooled connection. \n\n##### Parameters\n\n| user | the database user on whose behalf the connection is being made |\n| password | the user's password |\n|----------|----------------------------------------------------------------|\n\n##### Returns\n\n- a `PooledConnection` object that is a physical connection to the database that this `ConnectionPoolDataSource` object represents \n\n##### Throws\n\n| [SQLException](../../../reference/java/sql/SQLException.html) | if a database access error occurs |\n| | if the JDBC driver does not support this method |\n|---------------------------------------------------------------|-------------------------------------------------|"]]