Suppose I have MySQL Database called RetailStore and have table Order containing order related data which customer submitted via online applications. Our requirement is to write java program which will read data from DataSource which is configured in Weblogic for our MYSQL Database.
You need to follow below steps.
DataSource in WebLogic
Go to Services -> DataSource-> Create new DataSource. you will be asked to follow series of steps.
If you have MYSQL Db then please provide below configuration
You need to follow below steps.
- Create DataSource in WebLogic. I have used MySQL as DB and Weblogic 12.1.1 as Application Server.
- Test DataSource in weblogic
- Create HashMap consisting Initial Context Factory and Provider URL
- Create initial context Factory
- Do Lookup on context using JNDI configured for DataSource and have dataSource instance
- Get Connection from DataSource and Perform common JDBC Logic to read data from Table.
DataSource in WebLogic
Go to Services -> DataSource-> Create new DataSource. you will be asked to follow series of steps.
If you have MYSQL Db then please provide below configuration