It is not clear from where you are trying to connect to the datasource. If you are trying to connect to the datasource from a remote client, in a VM separate to the JNDI, you will not be able to access the datasource.
See this thread.
No, I'm in the VM of JBoss. I'm trying to access the datasource from a class called by a servlet. I check the connection to the datasource in the System.out which displays in the JBoss console.
So, I know the database is running. Because I try the same twice. One class connecting to the database by calling the driver directly and the other via JNDI. Both at the server vm.
So, it looks like I'm simply not able to configure JNDI right?
Ok, I fixed the problem. Looking at http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= I recognized it wasn't a problem with JBoss but with my code. I was porting it from another app server, and I didn't keep in mind that the JNDI variables in JBoss where named differently! So after changing the call to java:/... it worked.