Main Page

Monday, 1 February 2021

Data Source configuration to connect to MySQL DB

 Step 1) Install and Configure MySQL Data Base.

https://middlewareadmin-pavan.blogspot.com/2021/01/creating-mysql-database-on-centos.html

Step 2) Make sure you are able to establish a connection between WebLogic host machines and DB host

DB Host IP and Port numbers are : 192.168.1.241/3306

[osboxes@machine1 logs]$ timeout 2 bash -c 'echo >/dev/tcp/192.168.1.241/3306' && echo "connection status: success" || echo "connection status: failed"

connection status: success

[osboxes@machine2 bin]$ timeout 2 bash -c 'echo >/dev/tcp/192.168.1.241/3306' && echo "connection status: success" || echo "connection status: failed"
connection status: success

Step 4) Configure Data Source with the following specifications. 

Name:  testmysqlDS
JNDI Name:  testmysqlDS
Database Type:  MySQL
Database Driver:  MySQL's Driver (Type 4) Versions:using com.mysql.jdbc.Driver
Database Name: HRDATABASE
Host Name:   mysqldbhost
Port:    3306
Database User Name: PBPUBLIC
Password:   PBPUBLIC@a1
Initial Capacity:       5
Maximum Capacity:   15
Capacity Increment:    5
Login Delay:     1
Target:      Cluster_1
















Test the DB connection.














Step 4) Deploy testds.war application


























Step 5) Test the application. I have tested the application on ManagedSever_1 and 3

http://192.168.1.196:9002/testds
http://192.168.1.197:9004/testds








Step 6) Verify the logs

/home/osboxes/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/servers/ManagedServer_1/logs
[osboxes@machine1 logs]$ tail -3 ManagedServer_1.out
Looking up the testmysqlDS data source.
Getting the connection from the database.
Querying the database.

/home/osboxes/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/servers/ManagedServer_3/logs
[osboxes@machine2 logs]$ tail -3 ManagedServer_3.out
Looking up the testmysqlDS data source.
Getting the connection from the database.
Querying the database.



No comments:

Post a Comment