Forums Register Login

JDBC,JNDI,DataSource

+Pie Number of slices to send: Send

Hi,

Can anyone explain how these three works together?


Thanks in Advance.
+Pie Number of slices to send: Send
You can define a JDBC datasource in JNDI.
You can use JNDI API do obtain the JDBC datasource in your Java code.
You can use the JDBC datasource to get a connection to the database.
+Pie Number of slices to send: Send
JDBC is slight similar to JNDI because they are both OO Java API. The JNDI is mostly used for accessing a native interface while the JDBC is more on relational database. You can use JDBC without JNDI or you can use both. Based on your question, the JNDI, JDBC and DataSource can be used together for a purpose. Based on my previous project I used bought because it is part of the technical requirements and I implemented it through Web XML and on my other project I used the Spring Configuration.

The JNDI part was stored on WebSphere variable, so I used the JNDI to call it. The datasource is created on the WebSphere DB connection and the JDBC is my driver or connector type. In WebSphere you can use any type of JDBC, but on my project I used JDBC type 2 because I don't need advance features which is on JDBC type 4.

DataSource reference by JDBC and JDBC can be called by JNDI. For simplistic way: JNDI ( JDBC (DATASOURCE)))

This is just my thought.
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2510 times.
Similar Threads
Doubt in Datasource and Java Database connectivity
jdbc provider-datasource creation
Program using DataSource...
was advanced single server 4.0 + db2 udb ERROR
What is JNDI ENC???
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:14:41.