Add a data source
if you use connection pools to connect to databases, configure JNDI in your application server to enable access to the connection pools as needed.
Procedure
1. Click Admin Console in the user menu of the program bar.
2. Expand the JDBC Configuration tab.
4. Click Data Sources to see a list of existing data sources.
Initially, this lists the data source for the MashZone NextGen Repository and for the Snapshots repository.
5. Click Add data source to create a new data source.
6. Enter a Data source Name for a new data source.
Note: | Data source names may contain ASCII alphabetic characters and numbers only. Data source names may not contain any punctuation or symbols, such as periods (.), dashes (-) or underscores (_). |
7. Select the appropriate driver for this datasource in the JDBC Driver drop-down menu.
8. In the JDBC URL field, enter either the URL for a JDBC connection or the JNDI name for a connection pool to connect to this data source. Common URL or JNDI forms include:
jdbc:mysql://hostname/databasename Important: | For MySQL databases, it is recommended that you include the database name in data source URLs. If this information is omitted, testing the data source fails and may also cause errors with access to stored procedures. |
jdbc:oracle:driver-type@hostname:port jdbc:postgresql://hostname:port/database-name jdbc:jtds:sqlserver://hostname:port;database-name jdbc:sqlserver://hostname:port;databaseName=database-name jdbc:sybase:Tds:hostname:port java:context-path/jndi-resource-name or
context-path/jndi-resource-name 9. Optionally, enter the Username and Password to use to connect to this database.
10. Click Show connection pooling options to display further options.
11. Optionally, set connection pooling options for this data source:
Initial Size = the initial number of connections to create when the pool for this data source starts up. This defaults to 0.
Maximum Active = the maximum number of connections that can be allocated at one time for this data source. This defaults to 8. Set this to -1 to remove all limits.
Maximum Wait = the maximum number of milliseconds that the pool will wait when no connections are available before failing. Defaults to -1 which is an indefinite wait.
Maximum Idle = the maximum number of connections that can be idle without connections being released for this data source. Defaults to 8. Set this to -1 to prevent any connections being released.
Minimum Idle = the minimum number of idle connections that can exist before new connections are added to the pool for this data source. This defaults to 0, indicating no new connections should be created.
Pool Prepared Statement = set this option to allow prepared statements for the database mashables that use this datasource to be pooled. This is disabled by default.
The usefullness and effect of pooling prepared statements depends on the type of database for this connection. See documentation for your database for more information or recommendations.
Validation Query = the SQL query that is used to validate connections in the pool for this datasource.
Validation Call Timeout = the number of milliseconds before a connection validation check is considered to have failed, causing the pool to invalidate and discard the connection. If you set this property to a number less than zero, validation calls do not expire, which is the default behavior.
Time Between Eviction Runs = the number of milliseconds between tests for idle connections for this datasource. This defaults to -1, which prevents all idle connection testing.
No of tests per run = the number of connections to test during any idle test run for this datasource. This defaults to 3.
Minimum Evictable Idle Time = the minimum number of milliseconds that a connection can be idle before being tested for eviction. This defaults to 30 minutes (1800000 milliseconds).
12. Click Save changes.