How to connect to Database from Oracle WebLogic Server :
You first create JDBC Datasource (or multi data sources) and then deploy this JDBC datasource (or multi datasource) to WebLogic Server (or cluster) in Domain.
You first create JDBC Datasource (or multi data sources) and then deploy this JDBC datasource (or multi datasource) to WebLogic Server (or cluster) in Domain.
Datasource: contains pool of database connections that are created when datasource instance is created i.e.
a) When it is deployed or targeted
or
b) Server start-up
a) When it is deployed or targeted
or
b) Server start-up
Multi Datasource : Abstraction around data source to provide load balancing or failover for datasource which are part of Multi Datasource.
.
Who can create JDBC Resource - Administrator or Programmer
Who can create JDBC Resource - Administrator or Programmer
How a JDBC resource is created - Using
i) Administration Console (by Administrator)
ii) WLST (WebLogic Scripting Tool) (by Administrator)
iii) by Programmatically using JMX API (by Developer)
i) Administration Console (by Administrator)
ii) WLST (WebLogic Scripting Tool) (by Administrator)
iii) by Programmatically using JMX API (by Developer)
System v/s Application JDBC Module - JDBC Modules created by Administrator using Console or WLST are called as System JDBC module where as JDBC module created by developer using WebLogic Workshop, other IDE (Integrated Development Environment) or XML editor are called as Application JDBC Module.
How JDBC Datasource is stored on server - as XML File under $DOMAIN/config/jdbc directory. i.e. $WEBLOGIC_HOME/ user_projects/ domains/ [domain_name]/ config/ jdbc/
config.xml file in “$WEBLOGIC_HOME/user_projects/domains/[domain_name]/config” points to JDBC datasource configuration file via parameter jdbc-system-resource
sample entry in config.xml
which means JDBC configuration file is at “$WEBLOGIC_HOME/ user_projects/ domains/ [domain_name]/ config/ jdbc/ JDBC1-1894-jdbc.xml”
WebLogic Server JDBC for Database connection : Step by Step
This is in continuation of my last post on Database Connectivity (JDBC) in WebLogic Server here , In today’s post I am going to cover step by step JDBC configuration using Administration Console.
1. Login to WebLogic Server Administration console (default port 7001)
http://hostname:port/console
http://hostname:port/console
.
3. Click on New button on right side as shown above
4. Enter JDBC Name, JNDI Name, Database & Driver type as shown below
.
.
5. In next screen, enter database connection pool details i.e.
– Database Name
– Host Name (on which database is running)
– PortNumber (on which database listener is listening)
– Database User Name
&
– Password (for database user)
– Database Name
– Host Name (on which database is running)
– PortNumber (on which database listener is listening)
– Database User Name
&
– Password (for database user)
.
6. In next screen you test connection by clicking on “Test Configuration” as shown below
.
.
7.Finally you select target servers (Administration and Managed Server in that domain) for that Datasource.
.
8. On clicking Finish button, you should see datasource as listed below
.
To create Multi Datasource
Steps mentioned above are to create single Datasource. To create Multi Datasource first create two or more Datasource as mentioned above (I created JDBC1 & JDBC2) then select Multi Datasources from console as shown below
.
.
.
2. Click on New button above, In next screen select Name of Multi Datasource and JNDI
.
.
.
3. Select Algorithm Typefor Multi Datasource i.e. Failover or Load Balancing
4. Select Datasource which you want to make part of Multi Datasource as shown below
.
.
5. Finally click on Finish to see Multi Data Sources