locked
Logon Failed for runtime oracle connection for Crystal Report - VS 2003.

    Frage

  • I'm getting a Logon Failed message when trying to view a web page with a crystal report embedded..   The error is:

    CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.

    I'm connected to an Oracle 9.x database to design the report using MSDAORA provider, Data Source U50DAMC_LINDA (as defined in my tnsnames file)

    I've attempted to add the login details to the report as shown below.


    ReportDocument rpmWorkloadDoc =
    new ReportDocument();

    string reportPath = Server.MapPath("tctoRPMWorkloadReport.rpt");

    rpmWorkloadDoc.Load(reportPath);

    rpmReportViewer.ReportSource = rpmWorkloadDoc;

    // Declare required variables.

    TableLogOnInfo logOnInfo = new TableLogOnInfo ();

    int i = 0;

    // Loop through every table in the report.

    for (i=0;i == rpmWorkloadDoc.Database.Tables.Count - 1;i++)

    {

    // Set the connection information for the current table.

    logOnInfo.ConnectionInfo.ServerName = "U50DAMC_LINDA.SW.NOS.BOEING.COM";

    logOnInfo.ConnectionInfo.UserID = "psrp_user";

    logOnInfo.ConnectionInfo.Password = "xxxxxx";

    rpmWorkloadDoc.Database.Tables Idea.ApplyLogOnInfo (logOnInfo);

    }

    Donnerstag, 1. September 2005 01:44

Antworten

  • Your code is setting the db logon after setting the .ReportSource of the viewer.  Move your ReportSource line to after successfully logging into the data source (after the ApplyLogonInfo() call).

    -Mandep
    Montag, 12. September 2005 19:27

Alle Antworten

  • Hello,

    Is this an ASP.NET app? I found this article:

    http://support.businessobjects.com/library/kbase/articles/c2015076.asp

    While the article talks about ODBC I believe that it is related as the ASP.NET worker thread will need rights to the Oracle client.

    You don't have all of the code, but it does look OK.  Here is an article on how to pass database log on information (C# is after the VB .NET).

    Is this being run on the same machine that you developed the report on?

    Keith - Business Objects

    Donnerstag, 1. September 2005 19:55
    Moderator
  • thanks Keith,  I think you forgot to paste the 2cd link.  I read the first article & opened up priv on my ora92 folders & that didn't help..  

    any other ideas??    Linda
    Donnerstag, 1. September 2005 20:49
  • Your code is setting the db logon after setting the .ReportSource of the viewer.  Move your ReportSource line to after successfully logging into the data source (after the ApplyLogonInfo() call).

    -Mandep
    Montag, 12. September 2005 19:27
  • I am facing a problem to connect the DB at runtime, In my project,

     

    I am sucessfully able to run the reports from my VB Code for the connection detail same in rpt file and the connection detail that I am setting dynamically.

     

    But if I change the connection detail from application, then it stop working and throw error. For Example, If I am using 'test' tns in both rpt and code, then it is working file. But if i change in vb code, my report stop working.

     

    please help me

     

    Amit

    Donnerstag, 11. Oktober 2007 12:59
  • I am facing a problem to connect the Oracle Database at runtime,In my asp.net(VB) project.

     

    Please Give the Code and Help me

     

    Surjyendu

    • Als Antwort vorgeschlagen BelMethos Dienstag, 12. August 2008 08:53
    Dienstag, 18. März 2008 08:16
  •  

    Hi All

    I have solved my problem so hopefully it will help you.
    Everyone kept going on about permissions to the temp folders and other folders but they never mentioned the Oracle folder.
    On your webserver you need to give the local ASP account rights to the oracle folder (c:\oracle\ora92 in my case). This then allows the Crystal Reports access to tnsnames.ora
    Another thing to try is enter your oracle folder as a PATH.

    http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=453603&SiteID=1

    Explains a bit, I did find a better site somewhere but cant find it now.

    Another problem I then experienced was I was unable to change the datasource of my report. I tried all things with connection details and finnaly came across the solution.

    This is an extract of what needs to be done. There are millions of pages and posts out there to full in the before and after code if you cant understand it....

    foreach (Table crTable in crReportDocument.Database.Tables)
    {
    crTableLogonInfo = crTable.LogOnInfo;
    crTableLogonInfo.ConnectionInfo.ServerName = "ServerName";
    crTableLogonInfo.ConnectionInfo.UserID = "UserName";
    crTableLogonInfo.ConnectionInfo.Password = "Password";
    crTableLogonInfo.TableName = crTable.Name; // *************See comment below
    crTable.ApplyLogOnInfo(crTableLogonInfo);
    crTable.Location = crTable.Name; // **************See comment below
    }
    rptInvoicePreview.ReportSource = crReportDocument;




    The 2 lines with "// **************See comment below" are the important ones. I know it doesnt really make sence (well to me atleast) as to why this works but it does.


    Hope that helps you and all the other people out there who spent hours and hours searching the net to no avail.

    Cheers

    BelMethos

    • Als Antwort vorgeschlagen BelMethos Dienstag, 12. August 2008 08:55
    Dienstag, 12. August 2008 08:54
  • After ApplyLogOnInfo(crTableLogonInfo) also the  table poinintg to old login inforamtion...

    Actullay I am trying to replace DSN to Oracle server  conncetion at run time.

    Thanks in advance for your solutions !!!! 
    Mathi
    Mittwoch, 13. August 2008 12:53