In JBoss 2.0.6 I configured a data source xml file that reads as:
<depends optional-attribute-name="ManagedConnectionFactoryName">
<!--embedded mbean-->
jdbc/EmpDirDS
<config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost/directory</config-property>
<config-property name="DriverClass" type="java.lang.String">com.mysql.jdbc.Driver</config-property>
<!--set these only if you want only default logins, not through JAAS -->
<config-property name="UserName" type="java.lang.String">EmpDir</config-property>
<config-property name="Password" type="java.lang.String">update44</config-property>
.....
Which worked fine by looking up the JNDI name "java:/jdbc/EmpDirDS".
After switching to JBoss 3.2 and realizing I needed to use the new xml format to avoid errors my xml file reads as:
<local-tx-datasource>
<jndi-name>jdbc/EmpDirDS</jndi-name>
<connection-url>jdbc:mysql://localhost/directory</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>EmpDir</user-name>
update44
</local-tx-datasource>
But now, using the following code returns a "jdbc not bound" error.
InitialContext iContext = new InitialContext();
DataSource ds = (DataSource) iContext.lookup("java:/jdbc/EmpDirDS");
con = ds.getConnection();
Can anyone tell me what I'm do wrong?
After continuing to read the forum a copy pages back, I found a message that explained and fixed the problem.
When using the tag, the file MUST end with -ds.xml. For example, empdir-ds.xml