What version of JBoss are u using?
I suppose the datasource definition file has to end with
-service.xml in 3.0.x and -ds.xml in 3.2.x
Im not very confident about 3.2.x but if its 3.0.x, it should end with -service.xml and not -db.xml
Do you have the resource reference mapping for the private ENC java:comp/env/MSSQLDS in your deployment descriptors?
I'm also trying to connect to MSSQL. The code is:
InitialContext context = new InitialContext();
ds = (DataSource) context.lookup("MSSQLDS");
And it gives a NamingException. I think it cannot find it.
In my mssql-ds.xml it is defined as simple
Is it important to use "java:comp/env/" prefix when call contex.lookup?
Have a look at the JNDI View in jmx-console to see what is actually bound.