In WebLogic Server, you can configure database connectivity by configuring JDBC data sources and multi data sources and then targeting or deploying the JDBC resources to servers or clusters in your WebLogic domain.
Each data source that you configure contains a pool of database connections that are created when the data source instance is created—when it is deployed or targeted, or at server startup. Applications lookup a data source on the JNDI tree or in the local application context (java:comp/env), depending on how you configure and deploy the object, and then request a database connection. When finished with the connection, the application calls connection.close(), which returns the connection to the connection pool in the data source.
A multi data source is an abstraction around data sources that provides load balancing or failover processing between the data sources associated with the multi data source. Multi data sources are bound to the JNDI tree or local application context just like data sources are bound to the JNDI tree. Applications lookup a multi data source on the JNDI tree or in the local application context (java:comp/env) just like they do for data sources, and then request a database connection. The multi data source determines which data source to use to satisfy the request depending on the algorithm selected in the multi data source configuration: load balancing or failover.
Creating a data source:
Firstly start the database; I am using the default database shipped with WebLogic i.e. Point Base.
Navigate to the following location and click on startPointBase to start the database.
WebLogic_Home/common/eval/pointbase/tools
In the admin console expand the services
node and again expand the JDBC node and click on Data Sources. Click New to
create one.
Enter the name and jndi name for the data source
Name testdatasource
JNDI Name testdatasource
Select the database type and database
driver
Database type PointBase
Enter the database name as demo
Enter PBPUBLIC for username and password and click next.
Click on Test Configuration and make sure Connection test succeeded.
Click Next to continue.
Select the target for datasource and click
finish. You can select multiple targets.
Click on the created data source.
Click on Connection Pool.
Expand the advanced option below it. Check
the TestConnections on Reserve.
Click on monitoring and click Testing.
Select the server and click on Test Data
Source.
That’s it you are done with creating Data
Source.
0 comments:
Post a Comment