on 05-06-2010 2:17 PM
Hi,
I am trying to change a reports runtime datasource using CR4E 2.0 jars. settableloccation method.
The reports are based on command objects.
code am using is:
final String TABLE_NAME_QUALIFIER = "SSS.";
final String SERVERNAME = "136.51.30.145";
final String CONNECTION_STRING ="!com.ibm.db2.jcc.DB2Driver!jdbc:db2://136.51.30.145:60000/UniQMI_H:retrieveMessagesFromServerOnGetMessage=true;!user=!password={pass@123}!ServerType=5!QuoteChar=\"";
final String DATABASE_CLASS_NAME = "com.ibm.db2.jcc.DB2Driver";
final String DATABASE_DLL = "crdb_jdbc.dll";
final String DBURI = "!com.ibm.db2.jcc.DB2Driver!jdbc:db2://136.51.30.145:60000/UNIQMI_H!ServerType=5!QuoteChar=\"";
final String DBUSERNAME = "user";
final String DBPASSWORD = "pass@123";
Tables tables = databaseController.getDatabase().getTables();
System.out.println("Table Size="+tables.size());
System.out.println(tables.getTable(0).getClass().getCanonicalName() );
ICommandTable oldtable = (ICommandTable)tables.getTable(0);
System.out.println(oldtable.getName());
oldtable.setName("Command");
oldtable.setAlias("Command");
System.out.println(oldtable.getAlias());
oldtable.setQualifiedName(TABLE_NAME_QUALIFIER+"Command");
System.out.println(oldtable.getQualifiedName());
IConnectionInfo connectionInfo = oldtable.getConnectionInfo();
PropertyBag innerProp = connectionInfo.getAttributes();
System.out.println(innerProp);
innerProp.clear();
PropertyBag propertyBag = new PropertyBag();
propertyBag.put("Trusted_Connection", "b(false)");
propertyBag.put("Server Name", SERVERNAME);
propertyBag.put("Connection String", CONNECTION_STRING);
propertyBag.put("Server Type", "JDBC (JNDI)");
propertyBag.put("Database Class Name", DATABASE_CLASS_NAME);
propertyBag.put("Use JDBC", "true");
propertyBag.put("URI", DBURI);
propertyBag.put("Database DLL", DATABASE_DLL);
connectionInfo.setAttributes(propertyBag);
connectionInfo.setUserName("user");
connectionInfo.setPassword("pass@123");
connectionInfo.setKind(ConnectionInfoKind.SQL);
oldtable.setConnectionInfo(connectionInfo);
databaseController.setTableLocation(oldtable,tables.getTable(0));
Can some one figure out where I am wrong?
Is the Schem Translation correct?
Regards,
Jon
Note : I have only one command in my report.
I get the following error from the application while changing report location from AIX to UNIX Box.
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException:
Unexpected database connector error---- Error code:-2147467259 Error code name:failed
Regards,
Jon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Likelihood is one of your parameters for the connections are wrong.
It's best to explicitly design a report against the target database connection, then read back the properties using code, then use those read-back values as a 'template'.
It might be the DBURI, but I haven't touched DB2 recently.
Sincerely,
Ted Ueda
Thanks TED,
I did the same but again same error:
Before setdatasource from the designer was able to retrieve following properties using displayconnectioninfo.java code:
**Table Properties **
Name Command
Alias Command
Qualified Name Command
**ConnectionInfo Properties **
User Name super
Password
Kind SQL
**ConnectionInfo Atttribute Properties **
JDBC Connection String !com.ibm.db2.jcc.DB2Driver!jdbc:db2://136.53.51.146:60000/SSS!user=!password=
PreQEServerName jdbc:db2://136.50.54.146:60000/SSS
Server Type JDBC (JNDI)
Database DLL crdb_jdbc.dll
Database SSS
Database Class Name com.ibm.db2.jcc.DB2Driver
Use JDBC true
Database Name SSS
Server Name jdbc:db2://136.50.54.146:60000/SSS
Connection URL jdbc:db2://136.50.54.146:60000/SSS
After setdatasource
**Table Properties **
Name Command
Alias Command
Qualified Name Command
**ConnectionInfo Properties **
User Name super
Password
Kind SQL
**ConnectionInfo Atttribute Properties **
JDBC Connection String !com.ibm.db2.jcc.DB2Driver!jdbc:db2://136.55.53.150:50000/SSS!user=!password=
PreQEServerName jdbc:db2://136.55.53.150:50000:60000/SSS
Server Type JDBC (JNDI)
Database DLL crdb_jdbc.dll
Database SSS
Database Class Name com.ibm.db2.jcc.DB2Driver
Use JDBC true
Database Name SSS
Server Name jdbc:db2://136.55.53.150:50000:60000/SSS
Connection URL jdbc:db2://136.55.53.150:50000:60000/SSS
Thanks,
Jon
My Template now looks like:
final String TABLE_NAME_QUALIFIER = "Command";
final String SERVERNAME ="jdbc:db2://136.55.53.150:50000:60000/SSS";
final String CONNECTION_STRING="!com.ibm.db2.jcc.DB2Driver!jdbc:db2://136.55.53.150:50000:60000/SSS!user=!password=!";
final String DATABASE_CLASS_NAME = "com.ibm.db2.jcc.DB2Driver";
final String DATABASE_DLL = "crdb_jdbc.dll";
final String DBURI="jdbc:db2://136.55.53.150:50000:60000/SSS";
final String DBUSERNAME = "super";
final String DBPASSWORD = "mypassword";
And still getting the error.
Thanks,
Jon
Thanks Ted ,
I have checked it with a working report. I am able to change table location for another report using same code. but it fails for a particular report. I tried to create a new report using same command(that is used in failing report) and surprisingly it works but doesnt works for this report.
What can be the problem?
Can you suggest me what can be the possible reasons for this error, I would confirm all those points are correct or not.
Regards,
Jon
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.