Skip to Content
author's profile photo Former Member
Former Member

Oracle Server Connection: Error finding JNDI Name

I am working on moving our RDC Component over to use Crystal Reports for Eclipse.

I have latest version of Crystal Reports for Eclipse (I think) - 2.0.6.r916. We use Oracle Server connections.

I am trying to rework some sample code so that I can connect my rpt to our database. I want to update whatever oracle server connection info the report currently has with a new db/username/password.

Whenever I try to use this code I get an 'Error finding JNDI Name'.

Here is my current code:

private static void switch_tables(DatabaseController databaseController) throws ReportSDKException

{

//For now just hardcode values until I can figure out how to conn

final String DBUSERNAME = "myusername";

final String DBPASSWORD = "mypassword";

final String DATABASE_NAME = "mydb.world";

//Obtain collection of tables from this database controller.

Tables tables = databaseController.getDatabase().getTables();

//Set the datasource for all main report tables.

for (int i = 0; i < tables.size(); i++) {

ITable table = tables.getTable(i);

//Change connection information properties.

IConnectionInfo connectionInfo = table.getConnectionInfo();

PropertyBag connInfoProperties = new PropertyBag();

connInfoProperties.putBooleanValue("Trusted_Connection", false);

connInfoProperties.put("PreQEServerName", DATABASE_NAME);

connInfoProperties.put("Server Type", "Oracle Server");

connInfoProperties.put("Database DLL", "crdb_oracle.dll");

connInfoProperties.put("ServerName", DATABASE_NAME);

connInfoProperties.put("Server", DATABASE_NAME);

connectionInfo.setAttributes(connInfoProperties);

//Set database username and password.

if (DBUSERNAME != null) {

connectionInfo.setUserName(DBUSERNAME);

connectionInfo.setPassword(DBPASSWORD);

}

connectionInfo.setKind(ConnectionInfoKind.SQL);

table.setConnectionInfo(connectionInfo);

//Update old table in the report with the new table.

//ERROR comes from this line: 'Error finding JNDI name (mydb.world)'

databaseController.setTableLocation(table, tables.getTable(i));

}

}/switch_tables/

Can anyone point me in the right direction? Thanks!

Edited by: kisetta on Sep 29, 2010 8:38 PM

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 02, 2010 at 10:28 PM

    Hello,

    Oracle doesn't use the concept of a database name. Set it to the empty string value and test again.

    Thank you

    Don

    Add a comment
    10|10000 characters needed characters exceeded

    • You can do that - and you really only have to do it once and then save the rpt file.

      That would eliminate the overhead of changing the schema - there is overhead, since the CR engine will have to validate the changes.

      How that's typically done is to create a report against the connection you want, then read off all the connection properties programmatically.

      Then in code, take the target document and set new connection properties to the ones you want.

      Sincerely,

      Ted Ueda

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2010 at 02:48 PM

    If you want to reference a JNDI datasource, we found the magic property was "JND Datasource Name" so our IConnectionInfo is set up like this:

        private IConnectionInfo getJNDIConnectionInfo() {
            IConnectionInfo connectionInfo = new ConnectionInfo();
            PropertyBag propertyBag = new PropertyBag();
    
            propertyBag.put("JNDI Datasource Name", getDataSourceURL());
    
            // required!!! (However, don't look for it in libraries. It is just a tag))     
            propertyBag.put("Database DLL", "crdb_jdbc.dll");
            
            connectionInfo.setAttributes(propertyBag);
            
            connectionInfo.setKind(ConnectionInfoKind.SQL);
    
            return connectionInfo ;
        }
    

    Where getDataSourcURL() returns the datasource e.g., "java:comp/env/jdbc/bpsprojectreport"

    I should qualify this by saying that in weblogic/oracle land, we have serious problems swapping datasources programmatically. But it seems to work fine for us in other environments such as tomcat or WebSphere.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.