All Downloads are FREE. Search and download functionalities are using the official Maven repository.

en.help.task-jdbcconnectionpoolnew.html Maven / Gradle / Ivy

The newest version!



To Create a JDBC Connection Pool

When creating a connection pool with the Administration Console, you are defining the aspects of a connection to a specific database.

Before You Begin

To create a connection pool, you must first install and integrate a driver supporting the JDBC API (JDBC driver). See To Integrate a JDBC Driver.

The following information is required to create the JDBC connection pool. Gather this information before proceeding:

  • Database vendor name

  • Resource type, such as javax.sql.DataSource (local transactions only), java.sql.ConnectionPoolDataSource (local transactions, possible performance improvements), javax.sql.XADataSource (global transactions), and java.sql.Driver

  • Data source class name

  • Required properties, such as the database name (URL), user name, and password

  1. In the navigation tree, select the Common Tasks node.

    The Common Tasks page opens.

  2. On the Common Tasks page, click the Create New JDBC Connection Pool button.

    The New JDBC Connection Pool (Step 1 of 2) page opens.


    Note - You can also access the New JDBC Connection Pool page by expanding the Resources node and the JDBC node, and selecting the Connection Pools node. Then from the Connection Pools page, click New to create a new connection pool.


  3. In the Pool Name field, type a name for the new connection pool.

    This is a required field.

  4. From the Resource Type drop-down list, select a resource type.

    Choices include javax.sql.XADataSource (global transactions), java.sql.ConnectionPoolDataSource (local transactions, possible performance improvements), javax.sql.DataSource (local transactions only), and java.sql.Driver.

  5. Specify a database vendor by performing one of the following actions:
    • From the Database Vendor drop-down list, select a database vendor.
    • If the database vendor does not appear in the list, type the name of the vendor in the Database Vendor text field.
  6. Click Next.

    The New JDBC Connection Pool (Step 2 of 2) page opens.

  7. In the Datasource Classname field, type the name of the vendor-specific class that implements the DataSource, ConnectionPoolDataSource, or XADataSource API.

    If you selected one of the datasource resource types, this field is usually filled in automatically with the class name associated with the resource type and database vendor you chose. If you selected the java.sql.Driver resource type, this field is disabled.

  8. In the Driver Classname field, type the name of the vendor-specific class that implements the java.sql.Driver API.

    If you selected the java.sql.Driver resource type, this field is usually filled in automatically with the class name associated with the driver and database vendor you chose. If you selected one of the datasource resource types, this field is disabled.

  9. Select the Ping Enabled checkbox to automatically ping the pool during pool creation or reconfiguration to identify and warn of any erroneous attribute values.

    This option is disabled by default.

  10. In the Description field, type a short description for the connection pool.
  11. In the Initial and Minimum Pool Size field, type the minimum number of connections for this pool.

    This value also determines the number of connections placed in the pool when the pool is first created or when the GlassFish Server starts. The default value is 8.

  12. In the Maximum Pool Size field, type the maximum number of connections for this pool.

    The default value is 32.

  13. In the Pool Resize Quantity field, type the number of connections per pool resizing batch.

    When the pool scales up and scales down toward the maximum and minimum pool size respectively, it is resized in batches. This value determines the number of connections in the batch. Making this value too large delays connection creation and recycling; making it too small will be less efficient. The default value is 2.

  14. In the Idle Timeout field, type the maximum amount of time, in seconds, that a connection can remain idle in the pool.

    After this time expires, the connection is removed from the pool. The default value is 300.

  15. In the Max Wait Time field, type the maximum amount of time, in milliseconds, that the application requesting a connection will wait before getting a connection timeout.

    The default value is 60,000.

  16. Select the Non Transactional Connections Enabled checkbox to return non-transactional connections.

    This option is disabled by default.

  17. From the Transaction Isolation Level drop-down list, select a transaction isolation level for this connection pool.

    If not specified, the connections operate with default isolation levels provided by the JDBC driver. By default, this option is not specified.

  18. Select the Isolation Level Guaranteed checkbox to ensure that all connections taken from the pool have the same isolation level.

    For example, if the isolation level for the connection is changed programmatically (with con.setTransactionIsolation) when last used, this mechanism changes the status back to the specified isolation level. This option is enabled by default.

    This setting is only applicable if a transaction isolation level has been specified.

  19. (Optional) In the Additional Properties section, specify additional properties.

    Examples of required properties include database name (URL), user name, and password. The table normally contains properties used by the database vendor. For information on some of the available properties, see Properties Specific to JDBC Connection Pools.

    If you do not specify a value for a property, it is removed from the table when you finish creating the connection pool. If you do not want to set a value for a property now, but you want the property to remain in the table so that the value can be set later, type a set of empty parentheses in the Value field:

    ()
    • To add a property, click the Add Property button. In the blank row that appears, type the property name in the Name field, and type the property value in the Value field.
    • To modify a property, edit that property's Value field.
    • To delete a property, select the checkbox to the left of the Name field of the property that you are deleting, then click the Delete Properties button.
  20. Click Finish.

See Also

Copyright © 2005, 2011, Oracle and/or its affiliates. All rights reserved. Legal Notices




© 2015 - 2024 Weber Informatics LLC | Privacy Policy