Question

Apparently this Tomcat data source gets registered in JNDI. The crystal reports API will then find the "jdbc/TESTDB" (below) under the JNDI name of "TESTDB". What is the easiest way to set this up in a stand-alone program? I have several data-sources reports, so my preferred method is to configure all JNDI entries so any that are needed will be referenced and used on-demand. Existing reports will not change and reference the ODBC connections.

I need to mimic this JNDI Tomcat entry in a stand-alone application. I'm not concerned about any of the max parameters:

<Context>

    <Resource name="jdbc/TESTDB" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="user" password="passwd" driverClassName="oracle.jdbc.OracleDriver"
               url="jdbc:oracle:thin:@dbserver:1521:db1"/>
</Context>

This is the crystal reports example that shows this setup in action using Tomcat:

http://www.javathinking.com/2011/09/using-the-crystal-reports-java-api-to-generate-pdf/

Was it helpful?

Solution

You need a JNDI provider. SimpleJNDI - http://code.google.com/p/osjava/wiki/SimpleJNDI - is usable in a application scenario outside a Java EE container.

You will need to investigate how to represent the data structure that Crystal Report needs, in the formats supported by SimpleJNDI.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top