I am having a problem retrieving a data source configured through Sun
Java Studio Creator, I went through the xml files and the resource is named jdbc/mysql. So I used the code:
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/mysql");
But this code, which works in my other applications is returning throwing a NameNotFoundException. Here is the creator created deployment descriptor segment:
<resource-ref>
<description>Rave generated DataSource Reference</description>
<res-ref-name>jdbc/mysql</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
and from sun-web.xml:
<resource-ref>
<res-ref-name>jdbc/mysql</res-ref-name>
<jndi-name>jdbc/mysql</jndi-name>
<default-resource-principal>
<name>username</name>
<password>password</password>
</default-resource-principal>
</resource-ref>
Is there anything that I am doing wrong, I have not had any problems with this before, using Netbeans /
Tomcat so I am wondering if there is a difference between Sun AppServer and Tomcat.
thanks,
Kerry