cancel
Showing results for 
Search instead for 
Did you mean: 

Get error when passing a server name to Crystal Report

Former Member
0 Kudos

I am developing a desktop application using VS 2012 with CRforVS_13_0_9 and CRRuntime_64bit_13_0_10 installed.  The database is SQL Server 2012 Express.  I use SQL OLEDB in Crystal Report to connect the SQL database.  Here is part of the codes.

   

Dim crTableLogoninfo As New TableLogOnInfo
    Dim crConnectionInfo As New ConnectionInfo
    Dim crTables As Tables
    Dim crTable As Table

    With crConnectionInfo
       

.ServerName = Login.sServer

        .DatabaseName = Login.sDatabase
        .UserID = Login.sDBUserID
        .Password = Login.sDBPassword
    End With

    Try
        crTables = CReport.Database.Tables
        For Each crTable In crTables
            crTableLogoninfo = crTable.LogOnInfo
            crTableLogoninfo.ConnectionInfo = crConnectionInfo
            crTable.ApplyLogOnInfo(crTableLogoninfo)
        Next
        CrystalReportViewer1.ReportSource = Nothing
        CrystalReportViewer1.ReportSource = CReport

I get an error "Failed to open connection -- Database vendor code 17" when I run a Crystal Reports through my application.  The problem is Crystal Reports does not like the server name which is passed.  The purpose for passing a server name is to connect to different server if needed.  I am not 100% sure the error occurs after VS 2012 or SQL Server 2012 express was updated.

Any ideas how I can fix this problem?

Thanks,

John

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

I did more testing.  I created 2 reports.  The provider for Report 1 is the Microsoft OLE DB Provider for SQL Server.  The provider for Report 2 is SQL Server Native Client 11.0.  Both reports work if no server passed to the reports.  If I pass the server, I get 2 different error message.  For report 1, I get the "Failed to open Database.  Database vendor code 17".  For report 2, a logon screen popped and ask for the password.  After I enter the password, I get the "Logon Failed." message.

Bottom line is Crystal Reports does not like the server name passed to it.

It is really appreciated if someone can help me to resolve this problem.

John

0 Kudos

Hi John,

First why are you using different DEV and runtime? Update VS 2012 to SP 10 also. Actually, wait until next week, SP 11 should be out.

MS has limitations using MDAC driver for SQL 2008 and above. Stick with the Native 10/11 clients.

Try using a connection that does not use CR. RowsetViewer is a OLE DB connection tool created by MS, search their site, and see if you can connect with and without a server name.

I've never heard of this before so not sure why, MS SQL Always requires a Server name or IP address.

Try Process Monitor, maybe it will give you more info what the connection string is being passed.

If you create a ODBC DSN using the Native 11 driver do you need to fill in a Server name?

Don

former_member183750
Active Contributor
0 Kudos

Have you looked up Database vendor code 17 in you db documentation? A small sampling of a simple google search;

http://stackoverflow.com/questions/17914605/crystal-report-throws-failed-to-open-the-connection-only...

Crystal: Failed to open Connection | The ASP.NET Forums

https://community.dynamics.com/sl/f/35/t/94890.aspx

E.g.; do see if a bit of searching will return other possible suggestions.

You may want to enable the options "Verify on 1st refresh" and "Verify SP on 1st refresh"

- Ludek

Former Member
0 Kudos

I have the most updated version of SQL Native 11 Client.

More info: Crystal Reports runs fine if I don't pass the server name to it.  Somethings broken after I have updated the VS 2012 and/or the SQL Server 2012 Express.

0 Kudos

interesting...

See this thread also:

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

Don

0 Kudos

Try using the IP address of the PC the server is installed on.

Don

former_member183750
Active Contributor
0 Kudos

Hi John

First, you want to check the error code in your database documentation. The error is being passed from the db client through the report engine totally unmodified. Googling the error will also be a good idea.

And, seeing as you are using SQL Server 2012, make absolutely sure that the SQL Native 11 client is installed.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter