Quantcast
Channel: SCN : Popular Discussions - SAP Crystal Reports, version for Eclipse
Viewing all articles
Browse latest Browse all 893

Error while changing the data source at runtime

$
0
0

Hi All,

 

I want to change the DB connection(from Dev to QA) in the code before viewing it to the user. I browsed through the samples and found a code. But when I', trying to use the code, I'm getting the following error.

 

com.crystaldecisions.sdk.occa.report.lib.ReportSDKLogonException: Logon Error: invalid arguments in call---- Error code:-2147217393 Error code name:dbLogonFailed

 

The following is the code:(Bold - problem area)

private static void switch_tables(DatabaseController databaseController) throws ReportSDKException {

final String DBUSERNAME = "irs_tin";

final String DBPASSWORD = "monica30";

final String SERVERNAME = "n3qvdb999.1dc.com";

final String CONNECTION_STRING = "Use JDBC=b(true);Connection URL=s(oracle.jdbc.OracleDriver://n3qvdb999.1dc.com:1631);" +

                                                   "Database Class Name=s(oracle.jdbc.OracleDriver);Server=s(n3qvdb999.1dc.com);" +

                                                   "User ID=s(irs_tin);Password=;Database=s(IRSQA);Trusted_Connection=b(false);" +

                                                   "JDBC Connection String=s(!oracle.jdbc.OracleDriver!jdbc:oracle:thin://n3qvdb999.1dc.com:1631;" +

                                                   "DatabaseName={database};user=;password=!)"; final String DATABASE_NAME = "IRSQA";          final String URI = "!oracle.jdbc.OracleDriver!jdbc:oracle:thin://n3qvdb999.1dc.com:1631;DatabaseName=;user=;password=!";

          final String DATABASE_DLL = "crdb_jdbc.dll";

           

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

 

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

ITable table = tables.getTable(i);

 

               //Keep existing name and alias.

               table.setName(table.getName());

               table.setAlias(table.getAlias());

IConnectionInfo connectionInfo = table.getConnectionInfo();

PropertyBag propertyBag = new PropertyBag();

propertyBag.put("Trusted_Connection", "false");

               propertyBag.put("Server Name", SERVERNAME); //Optional property.

               propertyBag.put("Connection String", CONNECTION_STRING);

               propertyBag.put("Database Name", DATABASE_NAME);

               propertyBag.put("Server Type", "JDBC (JNDI)");

               propertyBag.put("URI", URI);

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

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

               connectionInfo.setUserName(DBUSERNAME);

               connectionInfo.setPassword(DBPASSWORD);

               connectionInfo.setKind(ConnectionInfoKind.SQL);table.setConnectionInfo(connectionInfo);

 

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

                

}

 

}

 

Thanks for your time.


Viewing all articles
Browse latest Browse all 893

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>