Configure a JDBC Data Source in Oracle WebLogic Server 1700453941
Configure a JDBC Data Source in Oracle WebLogic Server 1700453941
LinkedIn: https://www.linkedin.com/in/prathamesh-sawant7882
Conventions
This tutorial uses the following conventions:
Entity Value
JAVA_HOME Environment
/u01/app/jdk
Variable
ORACLE_HOME Environment
/u01/app/oracle/product/11.2.0/xe
Variable
ORACLE_SID Environment
XE
Variable
$ cd ${APP_HOME}
2. Ensure that the database environment variables such
as ORACLE_HOME, ORACLE_SID, and PATH are set by printing them out using
the echo command:
3. $ echo ${ORACLE_HOME}
4. /u01/app/oracle/product/11.2.0/xe
5. $ echo ${ORACLE_SID}
6. XE
7. $ echo ${PATH}
${ORACLE_HOME}/bin:$PATH
Note: The values of your environment variables may be different. If there are no values
printed, then set the variables to the proper values:
$ export ORACLE_HOME=<valid_value>
$ export ORACLE_SID=<valid_value>
$ export PATH=<valid_value>
8. Invoke SQL Plus as the sysdba user:
$ ${ORACLE_HOME}/bin/sqlplus/ as sysdba
Note: If you are using the Oracle Database 12c, then invoke SQL Plus as /nolog user.
SQL> @testds_oracle.sql
This script creates a user called DBTESTER with the password that you have provided. It
grants the user the rights to create sessions, tables, and so on. It then connects to the
database as this user and creates three tables: EMPLOYEE, WLS_CATALOG_ITEMS,
and WLS_CLIENT_INFO. Finally, it inserts rows into those tables and exits.
Name: Prathamesh Sawant
LinkedIn: https://www.linkedin.com/in/prathamesh-sawant7882
$ cd /u01/domains/ExampleDomain/
2. In the domain directory, enter the command:
$./startWebLogic.sh
3. When prompted, enter the credentials of the domain administrator.
4. Examine the terminal output and wait for the Administration Server to reach
the RUNNING state.
1. After the Administration Server is up and running, access the WebLogic Server
Administration Console. Open a web browser and enter the Console's URL.
http://localhost:7001/console
Optionally, specify the host name and port of your domain's Administration Server in
place of localhost:7001 .
2. On the Welcome screen, enter the domain administrator credentials, and then click Login.
3. In the Change Center, click Lock & Edit.
Note: To create a data source, or change anything in the domain configuration, you must
first lock the domain configuration (to prevent other accounts from making changes
during your edit session) and enable an edit session.
4. In the left panel, under Domain Structure, expand Services and select Data Sources.
Name: Prathamesh Sawant
LinkedIn: https://www.linkedin.com/in/prathamesh-sawant7882
5. On the Summary of JDBC Data Sources page, click New and select Generic Data Source.
Field Value
localhost (use the host name where you have configured your
Host Name
Administration Server)
Database User
DBTESTER (this is the user defined in the SQL script)
Name
Database user's password (the password defined in the SQL script for
Password
above user)
If the test is unsuccessful, click Back and review the entries made for the data source,
correct any errors and then retry the test. If there are no errors in the entries and the test
still fails, make sure your database is running.
13. On the Select Targets page, select AdminServer as the data source target.
14. Click Finish to save the JDBC data source configuration and deploy the data source to the
AdminServer (target).
15. In the Change Center, click Activate Changes.
o The Console displays the message: All changes have been
activated. No restarts are necessary
o In the Summary of JDBC Data Sources page, the new data source, myNewDS, is now
listed in the Sources table.
16. To modify the configuration of the new data source, select the data source
name, myNewDS.
Name: Prathamesh Sawant
LinkedIn: https://www.linkedin.com/in/prathamesh-sawant7882
17. On the Settings for myNewDS page, select Configuration and then select Connection
Pool, and scroll down to find the capacity fields and change the existing values to:
The JNDI tree opens in a new window and myNewDS appears in the JNDI tree. Other
entries in the JNDI tree of your server may vary depending on the available resources in
your server.
$ cd ${APP_HOME}
o Run the deploy.sh script to deploy the web application in
the testds.war file and target it to the Administration Server. This script is part
of the example application (extracted earlier) into APP_HOME directory.
15. To use the deployed application, in another web browser, enter the host and port for the
Administration Server followed by /testds.
http://localhost:7001/testds
Field Value