What is the purpose of JNDI

JNDI is the Java Naming and Directory Interface. It’s used to separate the concerns of the application developer and the application deployer. When you’re writing an application which relies on a database, you shouldn’t need to worry about the user name or password for connecting to that database. JNDI allows the developer to give a … Read more

What does java:comp/env/ do?

Quoting https://web.archive.org/web/20140227201242/http://v1.dione.zcu.cz/java/docs/jndi-1.2/tutorial/beyond/misc/policy.html At the root context of the namespace is a binding with the name “comp”, which is bound to a subtree reserved for component-related bindings. The name “comp” is short for component. There are no other bindings at the root context. However, the root context is reserved for the future expansion of the policy, … Read more

How to use JNDI DataSource provided by Tomcat in Spring?

If using Spring’s XML schema based configuration, setup in the Spring context like this: <beans xmlns=”http://www.springframework.org/schema/beans” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:jee=”http://www.springframework.org/schema/jee” xsi:schemaLocation=” http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd”> … <jee:jndi-lookup id=”dbDataSource” jndi-name=”jdbc/DatabaseName” expected-type=”javax.sql.DataSource” /> Alternatively, setup using simple bean configuration like this: <bean id=”DatabaseName” class=”org.springframework.jndi.JndiObjectFactoryBean”> <property name=”jndiName” value=”java:comp/env/jdbc/DatabaseName”/> </bean> You can declare the JNDI resource in tomcat’s server.xml using something … Read more

What is JNDI? What is its basic use? When is it used?

What is JNDI ? It stands for Java Naming and Directory Interface. What is its basic use? JNDI allows distributed applications to look up services in an abstract, resource-independent way. When it is used? The most common use case is to set up a database connection pool on a Java EE application server. Any application … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)