Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BO XI 2 SP1 RAS- Error while setting table location (using JDBC- MSSQL)


I am using BO XI2 SP1 RAS (managed report) API, I am trying to modify ReportDocument's database info and parameters RUNTIME.

I am getting following error Failed to open the connection.

Failed to open the connection.

C:\WINDOWS\TEMP\{00F396A0-966B-41F5-8925-55632CCC94A1}.rpt---- Error code:-2147482892 Error code name:failed

at Source)

at com.crystaldecisions.proxy.remoteagent.s.a(Unknown Source)

at Source)

at Source)

at Source)

at Source)

at Source)

at com.crystaldecisions.proxy.remoteagent.v.a(Unknown Source)

at com.crystaldecisions.proxy.remoteagent.v.if(Unknown Source)

at Source)

at Source)

what does above error means and I am getting errror on the line databaseController.setTableLocation(originalTable, newTable);

Is anybody having Sample Code RAS with JDBC - what all property needs to be set with RAS API?, please let me know.



Edited by: Rupesh Raut on Sep 24, 2008 9:15 PM

Former Member

Hi Rupesh

Here is the Sample jsp Code for RAS with JDBC to change the database location at runtime.

<%@ page import = "*"

import = "*"

import = "*"

import = "com.crystaldecisions.sdk.plugin.desktop.common.IReportLogon"

import = ""

import = ""

import = "com.crystaldecisions.sdk.plugin.desktop.common.IReportTablePrefix"

import = "java.util.Iterator,*"

import = ""

import = ""

import = ""

import = "com.crystaldecisions.sdk.occa.managedreports.*"

import = "java.util.Locale"

import = "*"

import = "*"

import = "com.crystaldecisions.sdk.framework.*"

import = "com.crystaldecisions.sdk.occa.infostore.*"




<title>Simple Table Location - JDBC</title>



String mUser = "Administrator"; // User Name

String mPassword = ""; // Password

String mCMSName = "boxir2sp2";

String mAuthType = "secEnterprise"; // Authorization Type

String reportName = "Dynamic_WithoutChange";

String dbUID = "sa"; // Userid for new sql database

String dbPWD = ""; // Password for new sql database

// ========= CONNECTION INFO VALUES =========

String conn_url = "jdbc:sybase:Tds:D3279W2K3CR2:5000/model";

String db_class_name = "com.sybase.jdbc2.jdbc.SybDriver";

String default_behaviour = "Sybase";

String conn_string="!com.sybase.jdbc2.jdbc.SybDriver!jdbc:sybase:Tds:D3279W2K3CR2:5000/model;DatabaseName=;user=;password=!ServerType=1!QuoteChar=\"";

String data_source = "";

String db = "model";

String server = "D3279W2K3CR2";

String trusted_conn = "false";

String use_jdbc = "true";


// ========= LOGON TO CMS =========

CrystalEnterprise ce = new CrystalEnterprise();

ISessionMgr sm = ce.getSessionMgr();

IEnterpriseSession es = sm.logon(mUser, mPassword, mCMSName, mAuthType);

// Get the Report Application Factory service from Crystal Enterprise

IReportAppFactory rptAppFactory = (IReportAppFactory)es.getService("", "RASReportService");

// Get the InfoStore service from Crystal Enterprise

IInfoStore iStore = (IInfoStore)es.getService("", "InfoStore");

// Query infostore for InfoObject

IInfoObjects oInfoObjects = iStore.query("Select * from CI_INFOOBJECTS Where SI_INSTANCE=0 And SI_NAME='" + reportName + "'");

// Get a reference to the InfoObject object

IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(0);

IReportAppFactory reportAppFactory = (IReportAppFactory) es.getService("","RASReportFactory");

// Get reportclientdocument object

ReportClientDocument clientDoc = reportAppFactory.openDocument(oInfoObject, OpenReportOptions._openAsReadOnly , Locale.ENGLISH);

// ========= NEW CONNECTION INFO OBJECT =========

// Create connectionInfo and Property bag objects

ConnectionInfo ci = (ConnectionInfo) clientDoc.getDatabaseController().getConnectionInfos(new PropertyBag()).getConnectionInfo(0);

// Set new ConnectionInfo properties

PropertyBag logonPb = new PropertyBag();

logonPb.put("Connection URL", conn_url);

logonPb.put("Database Class Name", db_class_name);

logonPb.put("Generic JDBC Driver Behavior", default_behaviour);

logonPb.put("JDBC Connection String", conn_string);

logonPb.put("JNDI DataSource Name", data_source);

logonPb.put("Server", server);

logonPb.put("Database", db);

logonPb.put("Trusted_Connection", trusted_conn);

logonPb.put("Use JDBC", use_jdbc);

PropertyBag pb = ci.getAttributes();

// Set the connection info objects members

// 1. Pass the Logon Properties to the main PropertyBag

// 2. Set the Server Description tpo the new JDBC connection string

pb.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, "crdb_jdbc.dll");

pb.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, logonPb);

pb.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, server);


// Set the connectionInfo attribute to the PropertyBag


// Set Username and Password for this connection



// Set the Kind of connection. CRQE (Crystal Reports Query Engine) type


// ========= SET NEW CONNECTION INFO TO TABLES =========

Tables tables = clientDoc.getDatabaseController().getDatabase().getTables();

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

Table oldTable = (Table) clientDoc.getDatabaseController().getDatabase().getTables().getTable(x);

Table newTable = (Table) oldTable.clone(true);

newTable.setName( "Inventory" );//Inventory is new table name

newTable.setAlias( "Employee" );//Employee is new table Alias

newTable.setQualifiedName( "model.dbo.Inventory" );





clientDoc.getDatabaseController().setTableLocation(oldTable, newTable);


// Verify database


// ========= VIEW REPORT =========

CrystalReportViewer viewer = new CrystalReportViewer();






// Store viewer object in session

session.setAttribute( "crViewer", viewer);

response.sendRedirect( "viewer.jsp" );


Hope this helps you.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question