on ‎2009 Oct 30 10:16 AM
Hello, <br><br>
we are developing designing our reports on an Oracle database in a certain schema. To be able to run those reports at our customers we have written software which replaces our database schema by the one the customer uses besides other functionality. Often the tables used in the reports are at our customersu2019 databases synonyms on tables in yet another schema. <br>
Until we switch to the .NET SDK this was no problem. But if I now switch the table location to a synonym the report looses all internal information about the fields of the table. Thus all information about links to parameters and joins of tables are also gone.<br>
If I save the report after replacing the table locations and open the saved copy in the Crystal Designer, I can only see tables without any fields in the Database Expert.<br><br>
Iu2019m modifying the table location with code like in the following example:<br>
<code>
ReportDocument rdReport = new ReportDocument();<br>
rdReport.Load(sReportName, OpenReportMethod.OpenReportByTempCopy);<br>
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rcDocument = rdReport.ReportClientDocument;<br>
for (int i = 0; i < rdReport.Database.Tables.Count; ++i)<br>
{<br>
CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable rctTable = rcDocument.DataDefController.Database.Tables<i>;<br>
CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable rctNew = new CrystalDecisions.ReportAppServer.DataDefModel.Table();<br>
rctNew.Name = rctTable.Name;<br>
rctNew.Alias = rctTable.Alias;<br>
rctNew.QualifiedName = rctTable.QualifiedName.Replace("OLD_SCHEMA","NEW_SCHEMA");<br>
rctNew.ConnectionInfo = rctTable.ConnectionInfo.Clone(true);<br>
CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag pbAttr = rctNew.ConnectionInfo.Attributes;<br>
pbAttr[sAttrDBDll] = "crdb_ado.dll";<br>
pbAttr[sAttrDBName] = sDBName;<br>
pbAttr[sAttrDBType] = "OLE DB (ADO)";<br>
pbAttr[sAttrServerDesc] = sServerName;<br>
pbAttr[sAttrSQLDB] = "True";<br>
pbAttr[sAttrSSO] = "False";<br>
CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag pbLogOnProp = (CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag)pbAttr[sAttrLogOnProp];<br>
pbLogOnProp.RemoveAll();<br>
// set new connection string<br>
pbLogOnProp.FromString(sConnectStr);<br>
// set user/pwd<br>
rctNew.ConnectionInfo.UserName = sUserId;<br>
rctNew.ConnectionInfo.Password = sPwd;<br>
// apply changes<br>
rcDocument.DatabaseController.SetTableLocation(rctTable, rctNew);<br>
}<br>
</code>
<br>
Does anybody know if there is a workaround so that I can modify the table location to a synonym without loosing the field information?<br><br>
Thanks in advance.
Request clarification before answering.
Before you do this using any APIs, can you do it in the CR designer? 99% of the time, if it can not be done, or if it is an issue in the designer, the same will hold at runtime.
The symptom of the fields disappearing is indicative of the report not understanding the schema, or the schema not matching what the report is expecting. You may also want to try enabling the option Verify on First refresh and Verify Stored Procedure on First Refresh. You can do this in the designer, or code.
Ludek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ludek,<br><br>
If I use the Set Datasource Location in the designer and replace the original tables by synonyms (which point to the original tables), the designer can also find no field information. It is also not possible to build a report based on synonyms.<br>
I don't know how it is with other databases, but it seems that Oracle does not provide any meta information about the original object in synonyms.<br>
But the old COM-Api didn't seem to care about the missing field information, and I could switch from a table to a synonym.<br><br>
Greetings
The issue sounded familiar, so searching internally, there was an issue investigated using Oracle OLE DB to synonyms, and the problem (ADAPT00503823) was narrowed down to problems with how the Oracle OLE DB driver exposes the metadata.
Does this issue happen if you use a different driver?
Sincerely,
Ted Ueda
The JDBC issue I'm pretty familiar with, since I'd encountered it directly.
It's a different issue - the CR JDBC driver didn't support synonyms at all (i.e., it wasn't a issue with the Oracle JDBC thin driver).
The ADAPT's are internal tracking numbers - it's used as reference to issues, but not available externally.
Sincerely,
Ted Ueda
I also tried to use the Oracle Server connection using the crdb_oracle.dll. With this connection the meta information of the synonyms are read correctly and my problem described above does not appear. <br><br>
The question now is, is that a bug of Crystal Reports or a bug of Oracle/Microsoft?<br>
The similar bug in the JDBC driver was solved by Crystal, wasn't it? This would be a reason to file a bug report here.<br><br>
Sincerely,
Ron
I am having a similar problem with synonyms in crystal 2008 designer connecting to a sql server 2005 database using OLE DB provider. I can connect and the synonym shows in the field explorer with a plus sign but it doesn't allow you to expand the plus sign to show the fields and use them in a report!
Additionally if i design the report against the original table then run it in java crystal for eclipse subbing out the the database for a database where the synonym is present instead of the table it runs but finds no data.
Any ideas with these two problems?
Yeah Im running jdbc using the jtds sql driver. I design the report against the original table, then run the report in java using setTableLocation code to point to a database where this table is just a synonym. The synonym works for command based reports but not when i design against the original table like this.
Jeremy
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.