Skip to Content
Jun 26, 2015 at 06:50 AM

Database logon failed error from Crystal Report (Hana ODBC)



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


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

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

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


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

Any help could be appreciated.


ODBC Driver Version is : 1.0000.52

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


HanaODBC.jpg (36.1 kB)