Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 797
Randy L Avatar asked Nov 09 '09 17:11

Randy L


1 Answers

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.

like image 52
BalusC Avatar answered Sep 24 '22 21:09

BalusC