File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes JDBC,JNDI,DataSource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC,JNDI,DataSource" Watch "JDBC,JNDI,DataSource" New topic
Author

JDBC,JNDI,DataSource

miria joseph
Greenhorn

Joined: Dec 06, 2007
Posts: 7

Hi,

Can anyone explain how these three works together?


Thanks in Advance.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
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.
Bebot Arnado
Greenhorn

Joined: Feb 04, 2009
Posts: 6
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.


GreenLeaf
ReAch yOur GoAl wHile U hAve tImE.
OptImiZe and MaXiMize ResourCes whILe It is sTiLL FrEe
ThInK BeYonD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC,JNDI,DataSource