Crystal Reports for Eclipse Developer Guide

Data source connection properties

When changing a data source connection, you must specify the connection properties in your IConnectionInfo object. Specify these properties in a com.crystaldecisions.sdk.occa.report.lib.PropertyBag object and set them using the com.crystaldecisions.sdk.occa.report.data.IConnectionInfo.setAttributes method. There are two distinct sets of properties to define values for:
  • Default connection properties
    Every general kind of data source (com.crystaldecisions.sdk.occa.report.data.ConnectionInfoKind) has a set of default properties that can be set. For example, you can set the following properties for all connections:
    PropertyBag QEProperties = new PropertyBag();
    QEProperties.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, "crdb_dbtype.dll");
    QEProperties.put(PropertyBagHelper.CONNINFO_SERVER_NAME, "DBName");
    QEProperties.put(PropertyBagHelper.CONNINFO_SERVER_TYPE, "User friendly database type description");
  • Custom logon properties
    Each data source type has a different set of required logon properties. Store these properties in a PropertyBag. Here is an example for connecting to a local XML data source:
    QEProperties.putStringValue("Local XML File", "C:\\customer.xml");
    QEProperties.putStringValue("Local Schema File", "C:\\customer.xsd");
    QEProperties.put("Convert Mulitivalue to Table", false);

Tip: To more easily identify the key-value pairs of connection properties you can change for your data source, iterate through the property bag of an existing connection in a report (created through the Crystal Reports Designer) using the IConnectionInfo.getAttributes method.
PropertyBag QEProperties = connectionInfo.getAttributes();
java.util.Iterator it = QEProperties.keySet().iterator();

while (it.hasNext())
{
	Object key = it.next();
	Object value = QEProperties.get(key);
	out.println(key.toString() + " = " + value.toString() + " (" + value.getClass().getName() + ")<br>");
}



SAP BusinessObjects
http://www.sap.com/sapbusinessobjects/
Support services
http://service.sap.com/bosap-support/
Product Documentation on the Web
http://help.sap.com/