Search code examples
javajakarta-eedatasourcejnditomcat6

JNDI Names -- Is Prefix "jdbc/" needed?


What's up with JNDI names? I'm trying to get a javax.sql.DataSource using the new annotations feature of Java 5. It's not working for me, so I want to ask...

I have a in my web.xml, inside of it is an element. I'm switching between "jdbc/MyDB" and "MyDB". Neither makes my class-based DataSource work (it's always null) but in another example I've created using taglibs, both of these JNDI names work.


Solution

  • No, it is not. It is just the convention so that it's clear to everyone what resource it is.

    You can even name it k34ug6i2u3dn234uy5f, but that would lead to future maintenance problems.