Subject | Re: [Firebird-Java] Error finding JNDI name |
---|---|
Author | Rick Fincher |
Post date | 2004-02-03T22:30:14Z |
Hi Richard,
Is this in Tomcat? If this is Tomcat try going into the Administrator and
see if the DataSource is visible there.
It looks like that is OK, since your JSP code works.
Do you have the DataSource set up as a global naming resource?
You must reference the resource as a <resource-ref>, not as an <env-entry>.
You may also have to set up a <CONTEXT> for your web app that is using
Crystal Reports Viewer and define the DataSource inside that Context
(instead of globally) and put a resource authorization line in that Context
definition like:
<Resource auth="Container" name="jdbc/mark" scope="Shareable"
type="javax.sql.DataSource"/>
You can also set it up in a default context entry in server.xml if you want
that DataSource to be available to web apps without a specific <Context>
entry. Tomcat will auto-generate a context using settings in the
<DefaultContext> under each <host> or <engine>.
Then access with:
ds = (DataSource)ctx.lookup("java:comp/env/jdbc/mark");
Your web.xml entry would look like:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/mark</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Hope this helps,
Rick
Is this in Tomcat? If this is Tomcat try going into the Administrator and
see if the DataSource is visible there.
It looks like that is OK, since your JSP code works.
Do you have the DataSource set up as a global naming resource?
You must reference the resource as a <resource-ref>, not as an <env-entry>.
You may also have to set up a <CONTEXT> for your web app that is using
Crystal Reports Viewer and define the DataSource inside that Context
(instead of globally) and put a resource authorization line in that Context
definition like:
<Resource auth="Container" name="jdbc/mark" scope="Shareable"
type="javax.sql.DataSource"/>
You can also set it up in a default context entry in server.xml if you want
that DataSource to be available to web apps without a specific <Context>
entry. Tomcat will auto-generate a context using settings in the
<DefaultContext> under each <host> or <engine>.
Then access with:
ds = (DataSource)ctx.lookup("java:comp/env/jdbc/mark");
Your web.xml entry would look like:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/mark</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Hope this helps,
Rick
----- Original Message -----
>
>
> I have installed in server.xml and web.xml, the jndi settings,.... for a
> connection to a firebird database.
>
> When I check the setting it is working correct with jsp
>
> Context initContext = new InitialContext();
> Context envContext = (Context)initContext.lookup("java:/comp/env");
> DataSource ds = (DataSource)envContext.lookup("mark");
> Connection connection = ds.getConnection();
>
> But when I try to connect with crystal report viewer, he gives the
following
> error
>
> com.crystaldecisions.report.web.viewer.CrystalReportViewer
> Error finding JNDI name (mark)
>
> Thus anyone have an Idea what he is complaining about??
>
> Greetz richard