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 USE_JDBC = "true";

String DATABASE_DLL = "crdb_jdbc.dll";


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);





String TableName = "Custom_Query";

String TableAlias= "Custom_Query";

CommandTable table = new CommandTable ();

table.setAlias (TableAlias);

table.setName (TableName);


table.setCommandText("SET ROLE role");

databaseController.addTable(table, null);


catch (ReportSDKException e) {



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 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 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$ Source)

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

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

at 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 Source)

at Source)

at Source)

at Source)

at Source)

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

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

at Source)

at Source)

at Source)

at it.ServletHelper.querySetRole(

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


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