cancel
Showing results for 
Search instead for 
Did you mean: 

Database logon failed error from Crystal Report (Hana ODBC)

former_member682029
Contributor
0 Kudos

Hello

I am getting an exception from my C# Project while attempting to connect Crystal Report to the Hana Database. The Report was designed with CrystalReports 2011 SP6. From that environment, the report was successfully previewed. When trying to logon using the program, I am getting this exception.

CrystalDecisions.CrystalReports.Engine.LogOnException: Database logon failed. ---> System.Runtime.InteropServices.COMException: Database logon failed.

As demonstrated in many SAP tutorials, the System DSN is using for the connection.

DSN Name is : HANAODBC32

From the DSN, the connection is succeeding every time.

This is the code I added for Crystal Report

            Me.rptDoc = New CrystalDecisions.CrystalReports.Engine.ReportDocument

            Me.rptDoc.Load(sCRPath) ', OpenReportMethod.OpenReportByTempCopy)

            Dim DatabaseUsername As String = "SYSTEM"

            Dim DatabasePassword As String = "password"

            ServerName = "HANAODBC32"

            DatabaseName = "SBODEMOUS"

            c = New ConnectionInfo

            'Set Conenction info for DB

            With c

                .ServerName = ServerName

                .DatabaseName = DatabaseName

                .UserID = DatabaseUsername

                .Password = DatabasePassword

            End With

            Me.rptDoc.SetDatabaseLogon(DatabaseUsername, DatabasePassword, ServerName, DatabaseName)

            'Associate DB to the report

            crDB = Me.rptDoc.Database

            'Instantiate Tables collection

            crTables = crDB.Tables

            'Loop thru tables in report and set connection information

            For Each crTable In Me.rptDoc.Database.Tables

                TblLogonInfo = crTable.LogOnInfo

                TblLogonInfo.ConnectionInfo = c

                crTable.ApplyLogOnInfo(TblLogonInfo)

                If Not crTable.Location.Contains(".") Then Continue For

                crTable.Location = c.DatabaseName & ".dbo." & _

                         crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)

            Next

Tried to change the Server name with actual server name. but at that time, another message is showing

Any help could be appreciated.

Thanks

ODBC Driver Version is : 1.0000.52

Showing logon screen again and again when tried to Preview report from program.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member682029
Contributor
0 Kudos

Missed one thing

I can connect to Hana ODBC using my 32 bit program. But can't connect using my 64bit program. The Crystal Report is set with ODBC 32 bit. Is that the reason I can't connect from 64bit program?

Any Solution for this?

Former Member
0 Kudos

Hi Anoop,

Not playing with HANA since I don't have any box... And by the way no Customer willing to go.

Besides saying this, a while ago I worked a bit with it for one of SAP's Partners and I had the exact same issue and I remind it was documented: solution is to define the ODBC link in the 64 bits applet, which is using a different configuration than the 32 bits.

You can do a quick googling to find a lot of references, but basically you have to launche the ODBC managing applet from %systemdrive%\Windows\SysWoW64\odbcad32.exe to define the 64 bits entries.

Regards,

Eric