Changing the datasource of a Crystal Report to a Oracle DB using TNS
I have a problem trying to change the datasource of a crystal report. In the new connection I want to connect to a Oracle DB using TNS.
Without TNS it's finally working flawlessly with the following code:
private static void switch_tables(DatabaseController databaseController) throws ReportSDKException {
// Declare the new connection properties that report's datasource will be switched to.
final String DBUSERNAME = "user";
final String DBPASSWORD = "secret";
final String SERVERNAME = "jdbc:oracle:thin:@1.1.1.1:mysid";
final String URI = "!oracle.jdbc.OracleDriver!jdbc:oracle:thin:{userid}/{password}@1.1.1.1:mysid";
final String DATABASE_NAME = "mysid";
final String DATABASE_DLL = "crdb_jdbc.dll";
final String SCHEMA_NAME = "SCHEMA.";
// Obtain collection of tables from this database controller.
Tables tables = databaseController.getDatabase().getTables();
// Set the datasource for all main report tables.
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());
// Change properties that are different from the original datasource.
table.setQualifiedName(SCHEMA_NAME + table.getName());
// Change connection information properties.
IConnectionInfo connectionInfo = table.getConnectionInfo();
// Set new table connection property attributes.
PropertyBag propertyBag = new PropertyBag();
propertyBag.put("Trusted_Connection", "false");
propertyBag.put("Server Name", SERVERNAME); //Optional property.
propertyBag.put("Connection String", URI);
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.setAttributes(propertyBag);
// Set database username and password.
// NOTE: Even if these the username and password properties don't change when switching databases, the
// database password is not saved in the report and must be set at runtime if the database is secured.
connectionInfo.setUserName(DBUSERNAME);
connectionInfo.setPassword(DBPASSWORD);
connectionInfo.setKind(ConnectionInfoKind.SQL);
table.setConnectionInfo(connectionInfo);
// Update old table in the report with the new table.
databaseController.setTableLocation(table, tables.getTable(i));
I just call this method with the DatabaseController from a ReportClientDocument instance.
How do I need to change the connectionInfo to do the connection using TNS?
Please re-post if this is still an issue but first update to CR4E 2 and retest
Similar Messages
-
How to Call Crystal Reports XI from Oracle Forms 6i
hi can any one ,Please provide me the steps to call Crystal Reports XI from Oracle Forms 6i
very urgent please
if any Doument,attachment please send to [email protected]
Thanks in advance
Regards
S.Thirumalai selvanHi All,
Can anyone send me the steps to call Crystal Reports XI from Oracle Forms 6i (client/server)?
Thanks in advance, Lidija
My email is: [email protected] -
Can I edit the rpt file & change the datasource before loading the report?
We are an ISV and our application has a lot of reports. Our reports use a SQL Server database as the data source and each SQL Server at our customer sites has a different name.
In our testing we have determined that ReportDocument.Load tries to connect to the SQL Server that is saved in the RPT. If it can't fine the SQL Server saved in the RPT the load take about 60 seconds while it is waiting for the SQL Server Connection to time out.
We are using the Visual Studio 2008 version of Crystal Reports. This did not seem to be a problem with VB6/CR8.5.
We would like to edit the RPT and change the data source to the appropriate SQL Server before we call ReportDocument.Load.
Is it possible to edit the rpt file and change the data source before loading the report?
Or is there some way to tell Crystal not to try connecting to the DB
during the report.load?
In our case we will NEVER use the data source that is saved in the RPT, we will always change the data source using ApplyLogOnInfo.
ThanksHI Todd,
You Can Not edit the report document before ReportDocument.Load() because if you dont load the report then you dont have anything to Edit
But as far as changing the datasource is concerned you can change that at runtime.
For changing the datasource following code will help you if both databases have a same schema :
Code for changing the database
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "SERVER";
crConnectionInfo.DatabaseName = "DATABASE";
crConnectionInfo.UserID = "USERID";
crConnectionInfo.Password = "PASSWORD";
// Loop through the ReportObjects in a report and find all the subreports
foreach(ReportObject crReportObject in crReportDocument.ReportDefinition.ReportObjects)
// Check the kind of the ReportObject, if it is a subreport
// proceed. If not skip.
if(crReportObject.Kind == ReportObjectKind.SubreportObject)
// Get the SubReport in the form of a ReportDocument
string sSubreportName = ((SubreportObject)crReportObject).SubreportName;
ReportDocument crSubReportDocument = crReportDocument.OpenSubreport(sSubreportName);
// Use a loop to go through all the tables in the main report
foreach(Table crTable in crSubReportDocument.Database.Tables)
// Get the TableLogOnInfo from the Table and then set the new
// ConnectionInfo values.
TableLogOnInfo crLogOnInfo = crTable.LogOnInfo;
crLogOnInfo.ConnectionInfo = crConnectionInfo;
// Apply the TableLogOnInfo
crTable.ApplyLogOnInfo(crLogOnInfo);
// Set the location of the database. This value will vary from database to
// database.
crTable.Location = "DATABASE.OWNER.TABLENAME" or crTable.Locations;
The sample for doing this is available on support site.
Thanks,
Prasad -
Where is the Tech Support for Crystal Reports
Where is the technical support for Crystal Reports? I have just been through one of the worst technical supports circles in my entire career - this phone# to that phone# and only to be told you cannot talk to a Tech Support person. My dilema for anyone that can help - I am using Crystal Report 2008. I have mapped to a database in MS Access 2002. I copied the database to my desktop and created a test report. I can see the fields in the Field Explorer. I have dragged the fields onto the report and they are visible in Design View. I can see the data in the fields when I browse the fields. In the Preview View I do not see any data what-so-ever. I have not changed any defaults and have not suppressed or hidden information. The $1M question: Why can't I see the data on my report? I never had the problem when I used Crystal Reports v8.
The datasource shows my database. I believe that is what you meant. No data. IT has asked me to ask ? if in the Control Panel DSN if we need some information there. I don't have a clue - I am just a report writer and not an IT person.
-
Possible to change the datasource from a business-view to a Sql Command ?
Hello,
When a business view contains a lot of elements it takes a while just to open the report.
We'd like to keep the BV as the dictionnary, but,
once the report design completed,
we'd like to disconnect the business view and replace it by the Sql command which can be seen in the menu option 'show SQL query'.
Is it possible via the RAS sdk ?
Did somebody experience this ?
How to proceed ?
Thanks a lot
AlainHi Ted,
I'm thinking opening a Case for this problem of opening reports based on a big BV.
We can't really reduce the BV, since it is the dictionnary and we need the whole thing...
I'm wondering why it is impossible to change the Datasource if the tables and fields underneath are identical.
Is it impossible to change the fields' mapping ?
The other solution, as you suggest, is to create a report from scratch, create a new Datasource with the Sql command format, and rebuild the report... I agree it looks like a big job...
Do you know if it is possible to export the report in XML for instance, change the XML, and then re-import ?
Thanks for your Help.
Alain -
Error: Failed to open the connection when opening Crystal Report in CMC or
Hello all,
I am getting theError: Failed to open the connection when opening Crystal Report in CMC or Infoview
with access database as the datasource which is in the network drive.Hi Sonali,
This is because Crystal Reports does not recognize database connection from share drive
1. Save the database locally on server machine
2. Create a new database on server and link the new database with the database on Network.
Steps to link the database.
1.Create a new test database on server.
2. Go to File --> Get External Data --> Link tables | Select the database on Network Drive.
3. Select all the tables from the database.
4. Save the Database e.g. Test.mdb.
5. Create an ODBC Connection on server machine, with the same name as on client machine using test.mdb database.
Note: Click on Advanced button, enter the default user id and password for the odbc connection, it is not mandatory to give Login Name and Password, only if the user id and password are given then we need to provide the same user id and password in the CMC database configuration.
6. Create a report using this ODBC connection, and save the report to Enterprise.
Regards,
Navin -
How to change the datasource from one server to another server?
i need to change the datasource from development environment to production server. i had configured the JNDI informations like the following in the 'context.xml':
<Context path="/RFT" docBase="RFT" reloadable="true">
<Resource
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
validationQuery="select 1"
name="jdbc/datasource"
username="sa"
password="$m1sbag$"
maxIdle="-1"
maxActive="0"
maxWait="5000"
url="jdbc:microsoft:sqlserver://172.24.151.149:1433;databaseName=Projectgold" />
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
and in 'web.xml' included the following code:
<resource-ref>
<res-ref-name>jdbc/datasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
and mentioned the JNDI Connection Name in the .rpt file as 'jdbc/datasource', but still getting the same connection which one is configured during the report design. need a help to resolve this...
Thanks,
Rameventhough it's working fine. I may have deployment problem. Anyway thanks for the reply.
Regards,
Ram -
Crystal Report with 2 oracle datasources (left outer join) very slow
I've made a crystal report with 2 oracle datasources (2 commands). I'm using crystal 10.
These 2 data sources are linked with a left outer join.
The report takes a while to run (more then one hour).
i can run Both query's in a couple of seconds/minutes, but it looks like crystal is runniing the second query for each record in the first query.
When i make the same report in BO. Just 2 queries with merged dimensions in the report, it is taking a couple of minutes to complete the report.
Question is if somebody knows how crystal is handling these 2 different data sources.
Is there any way to say to crystal to fetch the data of both queries and do the join after that?
At the moment it looks like that crystal is going to the other datasource for each record in the first query, which will cost a lot of time.Joris,
I've always had a bad time combining a Command with any other object. Performance seems to drop dramatically, just as you've described.
I can't tell you specifically why, it falls off so bad...
The solution I've used is to do a linked server query (at least that's what it's called in MS SQL Server) I've never used Oracle, but I'd be VERY surprised if it didn't have that same feature. This will keep 100% of the processing on the server(s) and will get your run times back to what you would expect.
HTH,
Jason -
How is the best way to install the latest version of Crystal Reports 2008
I have been downloading for hours all the service packs, hot fixes, fix packs and chasing my tail for way too long on this.
I keep getting errors about a file being out of sequence.... I assume there is a very loooooong list of fixpacks that need to be applied!!! This is such a nightmare.
Is there a simple way to just install the latest version of 2008 Crystal Reports?
If I have to follow a long sequence of updates, is it written down anywhere?
The reason for this in the firstplace is because I moved to Visual Studio 2010 with .Net 4.0 framework and now none of my crystal reports work.
I am using the full version of Crystal Reports 2008 installation, not the one built into Visual Studio
HELP!!!!!!When I try installing SP2 it starts the update and just locks up... no errors... just sits there. I let it sit for about an hour.
Is it compatible with Windows 7 ?
When I tried installing a fixpack, I kept getting errors that a file was out of sequence. I will try uninstalling all of Crystal and just reinstall in this order:
1. Crystal Reports 2008 from CD
2. Install Crystal Reports 2008 SP2
3. Install FixPack 2.6
This is what I tried the first time and got all the errors, but I will try it again... is this correct?
(I don't need to install SP0 or SP1 or any other Fixpacks.... Correct?) -
Changing the Datasource of example CMP from Weblogic
I got an error message while running a successfully (?) deployed
Weblogic example bea\weblogic700\samples\server\src\examples\ejb20\basic\containerManaged.
The error message is like this when I run the "ant run":
run:
[java]
[java] Beginning containerManaged.Client...
[java]
[java] The client was unable to lookup the EJBHome. Please make
sure that you have deployed the ejb with the JNDI name
ejb20-containerManaged-AccountHome
on the WebLogic server at t3://localhost:7001
[java] Unable to look up the beans home: Unable to resolve
'ejb20-containerManaged-AccountHome' Resolved: ''
Unresolved:'ejb20-containerManaged-AccountHome
BUILD FAILED
D:\bea\weblogic700\samples\server\src\examples\ejb20\basic\containerManaged\build.xml:121:
Java returned: 1
The ConnectionPool and DataSource have been set through the Weblogic
Console.
Such that
Name: MySQLConnectionPool
URL: jdbc:mysql://localhost:3306/MyDatabase
Driver: Classname com.mysql.jdbc.Driver
Properties: user=sa
password=
Name: MySQLTxDataSource
JNDI Name: MySQLTxDataSource
Pool Name: MySQLConnectionPool
Then I modified the weblogic-cmp-rdbms-jar.xml, such that
<!-- the following line actually should be the JNDI name -->
<!-- data-source-name>examples-dataSource-demoPool</data-source-name
-->
<data-source-name>MySQLTxDataSource</data-source-name>
Then I got the above error. If I change the DataSource back to
examples-dataSource-demoPool. Everything works fine.
I could not find where the problem is. Could anyone give me a clue.
Thanks
Ruiwu TaoPlease re-post if this is still an issue but first update to CR4E 2 and retest
-
How to change the form of a COPA report?
Hi,
I want to change the form of a COPA report. How can i do that?
Moderator: Please, search SDNSave it back.
InfoObject.save or InfoStore.commit(InfoObjects).
Sincerely,
Ted Ueda -
Changing the datasource of LO cockpit inR/3..need a backup plan
Hi gurus,
i am going to change the datasource in production system i have done everything in Dev and QAs but my client is asking for a backup plan if something goes wrong.
like if the transport fails he want everthing to normal without effecting the setup of deltas and data in BW
can somebody suggest me what i can do as a backup plan if something goes wrong.
thanks and regards
neeluHi Neel
If something goes wrong and it mess up your deltas in Production system then what is the backup plan?
This is what I think -
If your data source is LO cockpit extractor then ensure following -
Before your R/3 transports ,stop V3 batch job .
Lock the users (transaction lock) ,
Stop batch jobs that will update base tables of extracor
Drain the delta queue into BW till you get 0 LUWs in RSA7 for that datasource in R/3 system.
Activate the last request in ODS and also send the data into Infocube . Now you have all data till that time into BW.
Import your transports. Then execute V3 job in R/3 and run Info package from BW .
If something is messed up then immdiately push another transport that will repair it .Then do Init without data transfer and resume deltas.
For other extractors just ensure to Drain the delta queue into BW till you get 0 LUWs in RSA7 for that datasource in R/3 system.(I assume that you will take care of batch jobs /transactional update - they should be stopped for any extractor)
Hope this plan helps you .
Please let me know if you still have questions.
Best of luck
Pradip -
How to enhance the Excel export from Crystal Reports
Hello,
I am new in Crystal Reports and I wonder if it is possible to enhance the Excel export from Crystal Reports with post-processing that would be applied to the Excel exported file.
By example, is it possible to freeze the window panes, so rows and columns are frozen in place on the screen?
Is there any possibility to obtain the file exported to excel to work with.
Or maybe there is some ways to parametrize the Excel export from Crystal Reports?
Any suggestions are welcomed.If you are using Crystal Reports 2008 you can use the Report Application SDK that is now available.
It has a object called PrintOutputController that has an export method that allows you to get access to the exported file before you send it to the user.
Check the Developer library and the samples for details.
<a href="/blog/10">Rob's blog - http://diamond.businessobjects.com/robhorne</a> -
How to view the History of a Crystal Reports iView in EP6?
How to view the History of a Crystal Reports iView in EP6?
Our Crystal reports are viewed via Crystal Enterprise and are both BW and non-BW Crystal reports.
I have looked at the three supplied iViews from Business Objects (alert, folder and thumbnail) but I have only been able to access the last instance or run on demand a CR.
Our users would prefer to see a listing of the past runs of the report and choose which report to view. What parameters need set in the EP6 iView to see the history of a report?Hi Heather,
it is correct that there is no sample iView that shows the History of Crystal Reports that are stored in Crystal Enterprise but there a sample codes on our web site and there are sample codes as part of the SDK documentation that show how to call the history and you should be able to take the code and create your own Java or ASP iView based on that.
the link to our developer library :
http://www.businessobjects.com/products/dev_zone/default.asp?intcmp=products12
hope this helps
Ingo -
Where to find the SQL log by crystal reports
i want to watch the sql log by crystal report loading,but i don't know how to find it , somebody knows it? thanks advanced!
Hi Wang,
If you mean to look at the SQL query CR generates, then open the report in the CR Designer > Go to the Database option on the top > Click Show SQL.
-Abhilash
Maybe you are looking for
-
HTML_DB.SEND - how to set a priority
I use the HTML_DB.SEND in a trigger to automatically generate email when the system runs into certain conditions. Is there any way to set the priority of these emails to "HIGH"? It appears that the priority option is not available in HTLM_DB. Please
-
Queries on Mac OS X support for Java 1.3
Hi All I am having some trouble figuring out how to make Swing based Applets work on Mac OS X. Can anybody help me ? Queries on Mac OS X support for Java 1.3 1) Will a Java Applet compiled using Java 1.3 run on "Mac OS X" without the need for a Plugi
-
Prob w/ Desktop app loader and my Storm
hello im writing because I have a serious issue with my blackberry desktop manager. it originally caught my attention when I tried to reinstall my bbm. I notice when I go into my application loader software It only displays the programs already insta
-
unable to receive messages but i can send message in ovi chat
-
Well it is just as the title of the post says. I purchased a macbook air through the online store because I needed the spanish keyboard on it. I selected the pickup option and sent it to one of the apple stores. The macbook was ready before schedule