hi, jndi is an api which provides a connection object to the programmer . by using jndi we can get the connection and the connection and given to the server. actually server maintain a connections which will call it a connectionpooling mechnisam. this type connection use jdbc to access the connection. we no need to write the Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection(url,username,password); this logic we just configure the following structure
if it is apache server:
Context context=new InitialContext();
DataSource datasouce=(DataSource)context.lookUp("java:comp/env/JndiName");
Connection con=datasource.getConnection()
it will provide the connection
if it is weblogic server
Context context=new InitialConntext()
ht.put(Context.INITIALCONTEXTFACTORY, "weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
DataSource datasouce=(DataSource)context.lookUp(ht);
Connection con=datasource.getConnection() it will provide the Connection object
and also one more answer the question it is like jdbc,hibernate jdbc uses the jdni, which provide a connection Hibernate is orm tool .hibernate is internaly use the jdbc api which will genarate the querys,prepate the connection object s
Ads