• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

JDBC,JNDI,DataSource

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

Can anyone explain how these three works together?


Thanks in Advance.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic