cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to open the connection: Details [Database Vendor Error Code 17] Failed to open connection

Former Member
0 Kudos

So unfortunately I continue to be plagued with driver/version inconsistency issues.   Same application code base and client as in below 2 links and similar situations.  It seems every time I need to touch these reports I struggle to get them deployed on and older set of ancillary software.

http://scn.sap.com/message/14433540#14433540

http://scn.sap.com/thread/3342435

Situation:

Existing reports writing in Crytsal XI, run from and ASP.NET app against SQL Server 2005 SP3.   All were upgraded about 1 year ago to .NET framework 4.0 for ASP.NET app code, Reports all upgraded with CR for Visual Studio (much struggles with that but eventually everything worked).

Now I have a single report I need to apply and additional filter to via a parameter and I can get it working locally in various development environments Inlcuding the two listed below:

  •      Visual Studio 2013, CR for VS SP 9, SQL Server 2014 Express
  •      Crystal Reports 2013 Trial against SQL Server 2005 SP3 inside a vm

No matter what I do in development I get the parameters prompted in the ASP.NET app, but the report fails with the error listed above when I try to deploy.   If I used SQL OLEDB, I get error 17 above and Error Code 53 if I use the native SQL Client.   I have even tried creating a brand new report using CR 2013 Trial with both drivers on the dev machine where I have the exact same DB (SQL Server 2005 SP 3)  as in the client test and production environments and as soon as I add a single parameter the report fails.

So what I continue to not understand (and wish the SAP team would address) is why does the actual report not use the same connection method as the parameters prompting?   The parameter prompting hits the same DB, (many times the same tables) and never fails, it is always the report that fails.

As I mentioned any help is appreciated.

Thanks

Tom

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Tom,

SP 9 had WEB app issues, upgrade to SP 13 and test again. And there have been issues with Parameters also.

Also, CR does not have a Native Database driver to SQL Server. So I assume you mean when creating a report using ODBC you are using the Native client dll?

Those errors are being passed to CR from the Client, so search those errors for more info.

Also, when you change the data source, update the SP I assume... you need to Verify Database in CR Designer so the copy of the table/SP is updated in the RPT file also.

Don

Former Member
0 Kudos

Don:

Thanks for the quick reply.  I will download SP 13 and try again.  When I say native driver I mean OLEDB one option is OLE DB for SQL the other is OLEDB SQL Native Client.

And yes I do verify db.  I can't remember if both CR for VS and CR 13 but at least 1 of them forces a verify on print preview in the designer.

I'll report back

Tom

Former Member
0 Kudos

OK so I downloaded and ran SP 13, as well as 64 bit runtime (it prompted me for that).  No change locally in dev environment.  Native client works (I know it won't when I deploy).   OLEDB straight re-prompts for logon credentials even thought they are set in code.

How do I know I am running the latest?  All the .NET assemblies still have  a 13.0.0.2 version number?  Am I not installing correctly?  Also my client is Win2K3 OS 32 bit, I wonder if I am struggling with a 64bit dev vs 32 bit deploy??  

0 Kudos

Hi Thomas,

Browse the GAC for the file version or you can get it in code this way:

foreach (Assembly MyVerison in AppDomain.CurrentDomain.GetAssemblies())
{
    if (MyVerison.FullName.Substring(0, 38) == "CrystalDecisions.CrystalReports.Engine")
    {
        //File:             C:\Windows\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\13.0.2000.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll
        //InternalName:     Crystal Reports
        //OriginalFilename:
        //FileVersion:      13.0.9.1312
        //FileDescription:  Crystal Reports
        //Product:          SBOP Crystal Reports
        //ProductVersion:   13.0.9.1312
        //Debug:            False
        //Patched:          False
        //PreRelease:       False
        //PrivateBuild:     False
        //SpecialBuild:     False
        //Language:         English (United States)

        System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(MyVerison.Location);
        txtRuntimeVersion.Text += fileVersionInfo.FileVersion.ToString();
        // check if CrsytalDecisions.Enterprise dll's can be loaded ( Anything but Cortez - managed reporting )
        if (fileVersionInfo.FileVersion.Substring(0, 2) == "13")
        {
            btnRasOpen.Enabled = false;
        }
        CRVer = fileVersionInfo.FileVersion.Substring(0, 2);
        return;
    }
}

You can download the MS SQL Native 10 client, it's works for both MS DB Servers.

To see if it is code causing the issue search for a KBA on how to enable crlogger... It will show you what CR is doing and may suggest why it's failing to log on.

Don


Former Member
0 Kudos

So I am unfortunately still fighting this issue.  I finally got new machines at my client with the latest OS, Sql server etc.   Same deal.   I even created a new report from scratch and get the same behavoir.

Questions at this point:

I downloaded and installed sp 13 on the client machine and my versions in the GAC still show 13.0.0.2, what am I doing wrong.

Set up crlogger environment vars from KB article and I get nothing in the log.  How do I activate logging?

0 Kudos

Hi Thomas,

You said you are using Server 2014 Express, you need to install the Client for SQL Server 2014 which should be the MS SQL Native 11 or possibly 12, we don't actually support SQL 2014 yet.

Actually didn't MS announce it no longer supports OLE DB with that DB Server? I think it's ODBC only.

I don't know if the Client tools come with SQL Express so check MS's site for more info.

When you create your connection you should see MS SQL Native 10 or 11 or 12, use one of those. The MDAC MS SQL Native driver is not fully supported with SQL above 2000.

Easiest place to find it is in the ODBC administrator under Drivers Tab

Don

Former Member
0 Kudos

I'm familiar with ODBC in the control panel.  However I am setting the driver in the individual report files (.rpt).   So this is strictly a crystal thing.  

So I am using SQL Native Client 10, from Crystal I have to get to it via the OLEDB database connections.   How to I get the native client to show up in Crystal?

Former Member
0 Kudos

So I think this is another part of my problem.   This is a new PC (as of April) I install the complete CR For Visual Studio Package 13.0.13 as well as the 64 bit runtime.   However is seems to get stuck on 13.0.2 as that is what always shows up in the GAC??

Former Member
0 Kudos

So just to be clear a few posts back you show 13.0.9 version of the crystal assemblies.   Not matter what I do I always seem to get 13.0.2 what gives here?   I just did a clean install of VS 2013 and Crystal to VS from the 13.0.13 download and the GAC shows version 13.0.2.   I think this is at the root of my problem..

DellSC
Active Contributor
0 Kudos

13.0.2 is always the assembly version that shows in the GAC.  13.0.9 is the file version - if you navigate to the folder where the SDK is installed and look at the properties of the assembly .dll files, you should see 13.0.9 there.

-Dell

Former Member
0 Kudos

So in the end I had to write my own parameter prompting for the single report that continued to give me problems.   I feel like I tried everything at my disposal.  Getting the client environments up to the latest versions.   Swapping db drivers on the report from OLEDB, to SQLNI, SQLNI10, SQLNI11.   Then all of the above on a brand new report. 

So I bit the bullet wrote the parameter prompting in ASP.NET used the OLEDB driver and everything works fine.

I guess I don't understand why I am not able to use the native SQL drivers, but I really can't spend anymore time on this.  Every time I use the native drivers I get re-prompted for DB credentials everytime the report viewer is shown event though the C# code sets credentials.

Oh well thanks, all for the assistance.

0 Kudos

Hi Thomas,

One thing to be aware of. ASP standards requires you to do most of the object loading in the Page_Init section. Previously our project templates loaded all CR info in the Page_Load event.

We changed this so now you should move your code into the Page_init section and then use Postback and sessions the keep the report in session.

If you don't it can have two effects, your report goes out of scope and you only get 1 or 2 pages and you have lost your database connection info.

That may explain why you are prompted for each page...

Don

Former Member
0 Kudos

Don:


Thanks for the feedback.  So below is my Page_Init.   The actual credentials get set in a button click event as the UI allows the user to select a report from a drop down then click run.

  private void Page_Init(object sender, EventArgs e)

        {

            if (Session[WebConstants.ReportKey] != null)

            {

                if (!this.IsPostBack)

                {

                    Session[WebConstants.ReportKey] = null;

                }

                else

                {

                    report = (ReportDocument)Session[WebConstants.ReportKey];

                    this.CrystalViewer.ReportSource = report;

                }

            }

        }

The other code called from button click;

public void ConfigureCrystalReports()

        {

            ConnectionInfo connectionInfo = new ConnectionInfo();

            string connectionString = ConfigurationManager.ConnectionStrings["ASCapitalBudgetConnection"].ConnectionString;

            string[] connectionStringPieces = (string[])connectionString.Split(';');

            string server = connectionStringPieces[0];

            server = server.Substring(server.IndexOf("=")+1, server.Length - (server.IndexOf("=")+1));

            connectionInfo.ServerName = server;

            string db = connectionStringPieces[1];

            db = db.Substring(db.IndexOf("=")+1, db.Length - (db.IndexOf("=")+1));

            connectionInfo.DatabaseName = db;

            string userId = connectionStringPieces[2];

            connectionInfo.UserID = userId.Substring(userId.IndexOf("=") + 1, userId.Length - (userId.IndexOf("=") + 1));

            string pw = connectionStringPieces[3];

            connectionInfo.Password = pw.Substring(pw.IndexOf("=") + 1, pw.Length - (pw.IndexOf("=") + 1));

            report = new ReportDocument();

            reportPath = Server.MapPath(this.CrystalReportFileName);

            report.Load(reportPath);

            SetDBLogonForReport(connectionInfo, report);

            Session[WebConstants.ReportKey] = report;

            this.CrystalViewer.ReportSource = report;

        }

        private void SetDBLogonForReport(ConnectionInfo connectionInfo,ReportDocument report)

        {

            Tables tables = report.Database.Tables;

            foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)

            {

                TableLogOnInfo tableLogonInfo = table.LogOnInfo;

                tableLogonInfo.ConnectionInfo = connectionInfo;

                table.ApplyLogOnInfo(tableLogonInfo);

            }

        }

Do you think this explains why it works with the OLEDB driver vs native?

0 Kudos

Hi Thomas,

You are building a lot of info dynamically, can you try simplifying?

Comment out all of the log on info and calls to it. What this should do is prompt for the log on info when viewed. The report does require being set to the DB server first and saved. Save it as a different report so you retain the original.

Now when you run the app it should prompt for your password. Once filled in then hit page 2 and it should simply go there, if not it is due to the report not being in session anymore.

If it works then use the original report and try adding in the log on info back in but hard code the log on info.

Oh, and can you attach the report, I don't need data. I would like to run it through my test app and see if I can find any issues with the report.

To attach rename the rpt to *.txt and use the Advanced editor to attach.

Don

Former Member
0 Kudos

Thanks for the feedback.   I thought I would paste the .NET code when you referenced using the Init method as opposed to the page load.   As I mentioned I fixed my issue by building my own parameter prompting.   The code above works flawlessly on 14 other embedded reports.

At this point we should consider this closed.

Thanks

Answers (0)