![]() ![]() ![]() ![]() |
Create a JDBC Data Source
Buttons Advanced Configuration Options
Use this page to create a JDBC data source. A JDBC data source is an object bound to the JNDI tree that provides database connectivity through a pool of JDBC connections. Applications can look up a data source on the JNDI tree and then reserve a database connection from a data source.
Buttons
Name Description Select Select the database type and JDBC driver that you would like to use to create database connections. Note: the * indicates that the driver is explicitly supported by Oracle WebLogic Server.
Configuration Options
Name Description Data Source Name A unique name that identifies this data source in the WebLogic domain.
MBean Attribute (Does not apply to application modules) :
JDBCDataSourceBean.Name
Changes take effect after you redeploy the module or restart the server.
Type The type of data source: Generic, GridLink, or Multi Data Source.
Database Type Select the database management system of your database. The Administration Console tailors the list of known JDBC drivers to the DBMS you select and constructs connection properties in a format that the DBMS supports.
Driver Class Name Select that driver that you want to use to create physical database connections. The data source pools the database connections for use and reuse by your applications.
* indicates that the driver is explicitly supported by Oracle WebLogic Server.
If your driver is not listed, select "other."
JNDI Name The JNDI path to where this data source is bound. By default, the JNDI name is the name of the data source.
To specify multiple JNDI names for the data source, enter each JNDI name on a separate line.
Applications that look up the JNDI path will get a
javax.sql.DataSource
instance that corresponds to this data source.MBean Attribute (Does not apply to application modules) :
JDBCDataSourceParamsBean.JNDINames
Changes take effect after you redeploy the module or restart the server.
Row Prefetch Enabled Enables multiple rows to be "prefetched" (that is, sent from the server to the client) in one server access.
When an external client accesses a database using JDBC through WebLogic Server, row prefetching improves performance by fetching multiple rows from the server to the client in one server access. WebLogic Server ignores this setting and does not use row prefetching when the client and WebLogic Server are in the same JVM.
MBean Attribute (Does not apply to application modules) :
JDBCDataSourceParamsBean.RowPrefetch
Changes take effect after you redeploy the module or restart the server.
Row Prefetch Size If row prefetching is enabled, specifies the number of result set rows to prefetch for a client.
The optimal prefetch size depends on the particulars of the query. In general, increasing this number will increase performance, until a particular value is reached. At that point further increases do not result in any significant performance increase. Very rarely will increased performance result from exceeding 100 rows. The default value should be reasonable for most situations.
MBean Attribute (Does not apply to application modules) :
JDBCDataSourceParamsBean.RowPrefetchSize
Minimum value:
2
Maximum value:
65536
Changes take effect after you redeploy the module or restart the server.
Stream Chunk Size Specifies the data chunk size for steaming data types.
Streaming data types (for example resulting from a call to
getBinaryStream()
) are sent in sized chunks from WebLogic Server to the client as needed.MBean Attribute (Does not apply to application modules) :
JDBCDataSourceParamsBean.StreamChunkSize
Minimum value:
1
Maximum value:
65536
Changes take effect after you redeploy the module or restart the server.
Buttons
Name Description Generate URL and Properties Select this button to enter the information required for WebLogic Server to create the fully qualified URL for your JDBC connections.
Test Database Connection Select this button to test this database connection.
Configuration Options
Name Description Database URL The URL of the database to connect to. The format of the URL varies by JDBC driver.
The URL is passed to the JDBC driver to create the physical database connections.
MBean Attribute (Does not apply to application modules) :
JDBCDriverParamsBean.Url
Changes take effect after you redeploy the module or restart the server.
Database Host Name The name or IP address of the database server.
Database Listener Port The port on the database server used to connect to the database.
Database Name Enter the name of the database that you want to connect to.
Database User Name The name of the user used to log into a database.
Password The password attribute passed to the JDBC driver when creating physical database connections.
The value is stored in an encrypted form in the descriptor file and when displayed in an administration console.
MBean Attribute (Does not apply to application modules) :
JDBCDriverParamsBean.Password
Changes take effect after you redeploy the module or restart the server.
DRCPConnectionClass The name of the connection class used to specify Database Resident Connection Pooling. Connection pools with the same value share pooled server processes on a WebLogic Server instance.
Test Table Name The name of the database table to use when testing physical database connections. This name is required when you specify a Test Frequency and enable Test Reserved Connections.
The default SQL code used to test a connection is
select count(*) from TestTableName
Most database servers optimize this SQL to avoid a table scan, but it is still a good idea to set the Test Table Name to the name of a table that is known to have few rows, or even no rows.
If the Test Table Name begins with
SQL
, then the rest of the string following that leading token will be taken as a literal SQL statement that will be used to test connections instead of the standard query. For example:SQL BEGIN; Null; END;
For an Oracle database, you can reduce the overhead of connection testing by setting Test Table Name to
SQL PINGDATABASE
which uses thepingDatabase()
method to test the Oracle connection.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.TestTableName
Properties The list of properties passed to the JDBC driver that are used to create physical database connections. For example: server=dbserver1. List each property=value pair on a separate line.
To enable driver-level features, add the driver property and its value to the Properties list. WebLogic Server sets driver-level properties in the Properties list on the driver's ConnectionPoolDataSource object.
- Note:
- For security reasons, when WebLogic Server is running in Production mode, you cannot specify database passwords in this properties list. Data source deployment will fail if a password is specified in the properties list. To override this security check, use the command line argument "weblogic.management.allowClearTextPasswords" when starting the server.
MBean Attribute (Does not apply to application modules) :
JDBCDriverParamsBean.Properties
Changes take effect after you redeploy the module or restart the server.
System Properties The list of System Properties names passed to the JDBC driver that are used to create physical database connections. For example: server=dbserver1. List each property=value pair on a separate line.
MBean Attribute (Does not apply to application modules) :
JDBCPropertyBean.SysPropValue
Changes take effect after you redeploy the module or restart the server.
Initial Capacity The number of physical connections to create when creating the connection pool in the data source. If unable to create this number of connections, creation of the data source will fail.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.InitialCapacity
Minimum value:
0
Maximum value:
2147483647
Maximum Capacity The maximum number of physical connections that this connection pool can contain.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.MaxCapacity
Minimum value:
1
Maximum value:
2147483647
Minimum Capacity The minimum number of physical connections that this connection pool can contain after it is initialized.
Default: InitialCapacity
Used only for connection pool shrinking calculations.
For compatibility,
InitialCapacity
is used ifMinCapacity
is not configured.Once a data source has gone through a suspend/resume, the larger value of either
MinCapacity
orInitialCapacity
is used.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.MinCapacity
Minimum value:
0
Maximum value:
2147483647
Statement Cache Type The algorithm used for maintaining the prepared statements stored in the statement cache.
Options are:
LRU - when a new prepared or callable statement is used, the least recently used statement is replaced in the cache.
FIXED - the first fixed number of prepared and callable statements are cached.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.StatementCacheType
Changes take effect after you redeploy the module or restart the server.
Statement Cache Size The number of prepared and callable statements stored in the cache. (This may increase server performance.)
WebLogic Server can reuse statements in the cache without reloading the statements, which can increase server performance. Each connection in the connection pool has its own cache of statements.
Setting the size of the statement cache to 0 turns off statement caching.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.StatementCacheSize
Minimum value:
0
Maximum value:
1024
Advanced Configuration Options
Name Description Test Connections On Reserve Enables WebLogic Server to test a connection before giving it to a client. (Requires that you specify a Test Table Name.)
The test adds a small delay in serving the client's request for a connection from the pool, but ensures that the client receives a viable connection.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.TestConnectionsOnReserve
Test Frequency The number of seconds a WebLogic Server instance waits between attempts when testing unused connections. (Requires that you specify a Test Table Name.) Connections that fail the test are closed and reopened to re-establish a valid physical connection. If the test fails again, the connection is closed.
In the context of multi data sources, this attribute controls the frequency at which WebLogic Server checks the health of data sources it had previously marked as unhealthy.
When set to
0
, the feature is disabled.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.TestFrequencySeconds
Minimum value:
0
Maximum value:
2147483647
Seconds to Trust an Idle Pool Connection The number of seconds within a connection use that WebLogic Server trusts that the connection is still viable and will skip the connection test, either before delivering it to an application or during the periodic connection testing process.
This option is an optimization that minimizes the performance impact of connection testing, especially during heavy traffic.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.SecondsToTrustAnIdlePoolConnection
Minimum value:
0
Maximum value:
2147483647
Shrink Frequency The number of seconds to wait before shrinking a connection pool that has incrementally increased to meet demand.
When set to
0
, shrinking is disabled.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.ShrinkFrequencySeconds
Minimum value:
0
Maximum value:
2147483647
Init SQL SQL statement to execute that will initialize newly created physical database connections. Start the statement with SQL followed by a space.
If the Init SQL value begins with
"SQL "
, then the rest of the string following that leading token will be taken as a literal SQL statement that will be used to initialize database connections. If the Init SQL value does not begin with "SQL ", the value will be treated as the name of a table and the following SQL statement will be used to initialize connections:
"select count(*) from InitSQL"The table
InitSQL
must exist and be accessible to the database user for the connection. Most database servers optimize this SQL to avoid a table scan, but it is still a good idea to setInitSQL
to the name of a table that is known to have few rows, or even no rows.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.InitSql
Changes take effect after you redeploy the module or restart the server.
Connection Creation Retry Frequency The number of seconds between attempts to establish connections to the database.
If you do not set this value, data source creation fails if the database is unavailable. If set and if the database is unavailable when the data source is created, WebLogic Server will attempt to create connections in the pool again after the number of seconds you specify, and will continue to attempt to create the connections until it succeeds.
When set to
0
, connection retry is disabled.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.ConnectionCreationRetryFrequencySeconds
Minimum value:
0
Maximum value:
2147483647
Login Delay The number of seconds to delay before creating each physical database connection. This delay supports database servers that cannot handle multiple connection requests in rapid succession.
The delay takes place both during initial data source creation and during the lifetime of the data source whenever a physical database connection is created.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.LoginDelaySeconds
Minimum value:
0
Maximum value:
2147483647
Changes take effect after you redeploy the module or restart the server.
Inactive Connection Timeout The number of inactive seconds on a reserved connection before WebLogic Server reclaims the connection and releases it back into the connection pool.
You can use the Inactive Connection Timeout feature to reclaim leaked connections - connections that were not explicitly closed by the application. Note that this feature is not intended to be used in place of properly closing connections.
When set to
0
, the feature is disabled.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.InactiveConnectionTimeoutSeconds
Minimum value:
0
Maximum value:
2147483647
Maximum Waiting for Connection The maximum number of connection requests that can concurrently block threads while waiting to reserve a connection from the data source's connection pool.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.HighestNumWaiters
Minimum value:
0
Maximum value:
2147483647
Connection Reserve Timeout The number of seconds after which a call to reserve a connection from the connection pool will timeout.
When set to
0
, a call will never timeout.When set to
-1
, a call will timeout immediately.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.ConnectionReserveTimeoutSeconds
Minimum value:
-1
Maximum value:
2147483647
Statement Timeout The time after which a statement currently being executed will time out.
StatementTimeout relies on underlying JDBC driver support. WebLogic Server passes the time specified to the JDBC driver using the
java.sql.Statement.setQueryTimeout()
method. If your JDBC driver does not support this method, it may throw an exception and the timeout value is ignored.A value of
-1
disables this feature.A value of
0
means that statements will not time out.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.StatementTimeout
Minimum value:
-1
Maximum value:
2147483647
Changes take effect after you redeploy the module or restart the server.
Ignore In-Use Connections Enables the data source to be shutdown even if connections obtained from the pool are still in use.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.IgnoreInUseConnectionsEnabled
Changes take effect after you redeploy the module or restart the server.
Pinned-To-Thread Enables an option to improve performance by enabling execute threads to keep a pooled database connection even after the application closes the logical connection.
When enabled:
WebLogic Server pins a database connection from the connection pool to an execution thread the first time an application uses the thread to reserve a connection. When the application finishes using the connection and calls
connection.close()
, WebLogic Server keeps the connection with the execute thread and does not return it to the connection pool. When an application subsequently requests a connection using the same execute thread, WebLogic Server provides the connection already reserved by the thread.There is no locking contention on the connection pool that occurs when multiple threads attempt to reserve a connection at the same time. There is no contention for threads that attempt to reserve the same connection from a limited number of database connections.
If an application concurrently reserves more than one connection from the connection pool using the same execute thread, WebLogic Server creates additional database connections and pins them to the thread.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.PinnedToThread
Changes take effect after you redeploy the module or restart the server.
Remove Infected Connections Enabled Specifies whether a connection will be removed from the connection pool after the application uses the underlying vendor connection object.
If you disable removing infected connections, you must make sure that the database connection is suitable for reuse by other applications.
When set to
true
(the default), the physical connection is not returned to the connection pool after the application closes the logical connection. Instead, the physical connection is closed and recreated.When set to
false
, when the application closes the logical connection, the physical connection is returned to the connection pool and can be reused by the application or by another application.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.RemoveInfectedConnections
Changes take effect after you redeploy the module or restart the server.
Wrap Data Types By default, data type objects for Array, Blob, Clob, NClob, Ref, SQLXML, and Struct, plus ParameterMetaData and ResultSetMetaData objects are wrapped with a WebLogic wrapper. This allows for features like debugging and connection usage to be done by the server.
The wrapping can be turned off by setting this value to false. This improves performance, in some cases significantly, and allows for the application to use the native driver objects directly.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.WrapTypes
Changes take effect after you redeploy the module or restart the server.
Fatal Error Codes Specifies a comma-separated list of error codes that are treated as fatal errors. These errors include deployment errors that cause a server to fail to boot and connection errors that prevent a connection from being put back in the connection pool.
This optional attribute is used to define fatal error codes, that when specified as the exception code within a
SQLException
(retrieved bysqlException.getErrorCode()
), indicate that a fatal error has occurred and the connection is no longer usable. For Oracle databases the following fatal error codes are predefined within WLS and do not need to be placed in the configuration file:
3113: "end-of-file on communication channel"
3114: "not connected to ORACLE"
1033: "ORACLE initialization or shutdown in progress"
1034: "ORACLE not available"
1089: "immediate shutdown in progress - no operations are permitted"
1090: "shutdown in progress - connection is not permitted"
17002: "I/O exception"
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.FatalErrorCodes
Changes take effect after you redeploy the module or restart the server.
Connection Labeling Callback The class name of the connection labeling callback. This is automatically passed to registerConnectionLabelingCallback when the datasource is created. The class must implement
oracle.ucp.ConnectionLabelingCallback
.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.ConnectionLabelingCallback
Changes take effect after you redeploy the module or restart the server.
Connection Harvest Max Count The maximum number of connections that may be harvested when the connection harvesting occurs. The range of valid values is 1 to MaxCapacity.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.ConnectionHarvestMaxCount
Minimum value:
1
Connection Harvest Trigger Count Specifies the number of available connections (trigger value) used to determine when connection harvesting occurs.
Harvesting occurs when the number of available connections is below the trigger value for a connection pool.
The range of valid values is -1 to
MaxCapacity
.Default value is
-1
.Setting the value to
-1
disables connection harvesting.MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.ConnectionHarvestTriggerCount
Minimum value:
-1
Connection Count of Refresh Failures Till Disable Specifies the number of test failures allowed before WebLogic Server disables a connection pool to minimize the delay in handling the connection request caused by a database failure.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.CountOfRefreshFailuresTillDisable
Minimum value:
1
Count of Test Failures Till Flush Specifies the number of test failures allowed before WebLogic Server closes all connections in a connection pool to minimize the delay caused by further database testing.
MBean Attribute (Does not apply to application modules) :
JDBCConnectionPoolParamsBean.CountOfTestFailuresTillFlush
Minimum value:
1
Configuration Options
Name Description Supports Global Transactions Select this option if database connections from this data source will be used in global transactions.
You may need to enable this option for use with EJBs.
If you enable support for global transactions with a non-XA JDBC driver, you must select an option for transaction processing.
One-Phase Commit Select this option if you want to enable non-XA JDBC connections from the data source to participate in global transactions using the one-phase commit transaction processing. With this option, no other resources can participate in the global transaction.
Emulate Two-Phase Commit Select this option if you want to enable non-XA JDBC connections from the data source to emulate participation in global transactions using JTA. Select this option only if your application can tolerate heuristic conditions.
With this option, the transaction branch in which the connection is used always returns success for the prepare phase of the transaction. This option offers performance benefits, but also has risks to data in some failure conditions.
Logging Last Resource Select this option if you want to enable non-XA JDBC connections from the data source to participate in global transactions using the Logging Last Resource (LLR) transaction optimization. This option is recommended in place of Emulate Two-Phase Commit.
With this option, the transaction branch in which the connection is used is processed as the last resource in the transaction and is processed as a one-phase commit operation. The result of the operation is written in a log file on the resource itself, and the result determines the success or failure of the prepare phase of the transaction. This option offers some performance benefits with greater data safety than Emulate Two-Phase Commit.
Two-Phase Commit This option is automatically selected if you select an XA JDBC driver. With this option, database connections from the data source fully participate in global transactions. The WebLogic Server transaction manager enforces the two-phase commit protocol.
![]() |