How to connect to WebLogic Data source or WebLogic JNDI Lookup in Java

Home/Java, WebLogic/How to connect to WebLogic Data source or WebLogic JNDI Lookup in Java

How to connect to WebLogic Data Source or Weblogic JNDI Lookup in Java

 

1. I have the following data source created in my WebLogic server. ( To Create A Data Source look at the following URL  create a Data Source )

 

030617_0315_Howtoconnec1 How to connect to WebLogic Data source or WebLogic JNDI Lookup in Java

 

2. In your Java Project, Add the weblogic.jar that present in your <WEBLOGIC_HOME>\server\lib.

 

               For Example: C:\Middleware\wlserver\server\lib

 

3. The following Java class do WebLogic JNDI Lookup.  It looks HR data source in my WebLogic and prints country names

Note: If you are going to deploy the code into a WebLogic server then the HashTable is not required. You can call the InitialContext without argument.  

 

pgn How to connect to WebLogic Data source or WebLogic JNDI Lookup in Java

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
pgn How to connect to WebLogic Data source or WebLogic JNDI Lookup in Java
Like us on Facebook.
Connect!