Skip to Content

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

How to use the Oracle's SET ROLE?

Hi all,

does anyone know how I can call SET ROLE (for Oracle) from java before the report is produced with

Crystal Reports API?

I'm using Crystal Reports 2008 for the report design and new crystal report java sdk of JRC (v12.2 with SP1) which know as CRJ in my J2EE application.

I tried to insert a Command (SET ROLE role) into a working fine report.

The report runned into Crystal Reports 2008 works fine.

Since has been made a high number of reports without a SET ROLE, to avoid to modify all the reports already made, I tried to run the SET ROLE from JAVA adding a CommandTable to report.

Below the code inserted into java class:

ConnectionInfos connInfos = new ConnectionInfos();

IConnectionInfo iConnInfo = new ConnectionInfo();

PropertyBag propertyBag = new PropertyBag();

try {

String usernameOracle = GestoreContesto.getAttributo("usernameOracleReport");

String passwordOracle = GestoreContesto.getAttributo("passwordOracleReport");

String connectString = GestoreContesto.getAttributo("dbUrl");

String driverName = "oracle.jdbc.OracleDriver";

//String driverName = "oracle.jdbc.OracleConnectionCacheImpl";

//String JNDIName = "jdbc/nsisrdatasource";

String userName = usernameOracle;

String password = passwordOracle;

String TRUSTED_CONNECTION = "false";

String SERVER_TYPE = "JDBC (JNDI)";

String USE_JDBC = "true";

String DATABASE_DLL = "crdb_jdbc.dll";

//String JNDI_OPTIONAL_NAME = JNDIName;

String CONNECTION_URL = connectString;

String DATABASE_CLASS_NAME = driverName;

propertyBag.put("Trusted_Connection", TRUSTED_CONNECTION);

propertyBag.put("Server Type", SERVER_TYPE);

propertyBag.put("Use JDBC", USE_JDBC);

propertyBag.put("Database DLL",DATABASE_DLL );

//propertyBag.put("JNDIOptionalName",JNDI_OPTIONAL_NAME );

propertyBag.put("Connection URL", CONNECTION_URL);

propertyBag.put("Database Class Name", DATABASE_CLASS_NAME);

iConnInfo.setAttributes(propertyBag);

iConnInfo.setUserName(userName);

iConnInfo.setPassword(password);

connInfos.add(iConnInfo);

String TableName = "Custom_Query";

String TableAlias= "Custom_Query";

CommandTable table = new CommandTable ();

table.setAlias (TableAlias);

table.setName (TableName);

table.setConnectionInfo(iConnInfo);

table.setCommandText("SET ROLE role");

databaseController.addTable(table, null);

}

catch (ReportSDKException e) {

System.out.println("......");

}

When I tries to render a report from Java I received this ERROR:

15:32:52,935 INFO [STDOUT] 15:32:52,935 FATAL [JRCCommunicationAdapter] Request failed and JRC Command failed to be undone

15:32:52,966 INFO [STDOUT] 15:32:52,951 ERROR [JRCCommunicationAdapter] detected an exception: Nessun risultato restituito dalla query.

at com.crystaldecisions.reports.queryengine.Table.u7(Unknown Source)

at com.crystaldecisions.reports.dataengine.datafoundation.AddDatabaseTableCommand.new(Unknown Source)

at com.crystaldecisions.reports.common.CommandManager.a(Unknown Source)

at com.crystaldecisions.reports.common.Document.a(Unknown Source)

at com.businessobjects.reports.sdk.requesthandler.f.a(Unknown Source)

at com.businessobjects.reports.sdk.requesthandler.DatabaseRequestHandler.byte(Unknown Source)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(Unknown Source)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(Unknown Source)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(Unknown Source)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(Unknown Source)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(Unknown Source)

at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(Unknown Source)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(Unknown Source)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(Unknown Source)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)

at com.businessobjects.sdk.erom.jrc.a.a(Unknown Source)

at com.businessobjects.sdk.erom.jrc.a.execute(Unknown Source)

at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(Unknown Source)

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

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

at com.crystaldecisions.sdk.occa.report.application.ds.a(Unknown Source)

at com.crystaldecisions.sdk.occa.report.application.an.a(Unknown Source)

at com.crystaldecisions.sdk.occa.report.application.b0.if(Unknown Source)

at com.crystaldecisions.sdk.occa.report.application.b0.b(Unknown Source)

at com.crystaldecisions.sdk.occa.report.application.bb.int(Unknown Source)

at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.performDo(Unknown Source)

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

at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source)

at com.crystaldecisions.sdk.occa.report.application.DatabaseController.byte(Unknown Source)

at com.crystaldecisions.sdk.occa.report.application.DatabaseController.addTable(Unknown Source)

at it.ServletHelper.querySetRole(ServletHelper.java:627)

It's a big problem. If anyone has any idea, I'd greatly appreciate it.

Thanks

Former Member
Not what you were looking for? View more on this topic or Ask a question