2

I am Trying to Connect MY Sap B1 HANA on C# Web Based Application using DI API but my connection is giving me error. Here is Error Screenshot Failed to Connect SLD,make Sure Your SLD Server is Available and Connected. Any Relevant Help would be Appreciated.

          try{

            oCompany.CompanyDB = "***";
            oCompany.Server = "***";
            oCompany.LicenseServer = "***:30015";

            oCompany.SLDServer = "***:40000";     //  
            oCompany.DbUserName = "****"; // 
            oCompany.DbPassword = "****"; //
            oCompany.UserName = "****"; //
            oCompany.Password = "****"; // 
            oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_HANADB;
            oCompany.UseTrusted = false;
            int res = oCompany.Connect();
            string errMsg = oCompany.GetLastErrorDescription();
            int ErrNo = oCompany.GetLastErrorCode();
            if (ErrNo != 0)
            {
                value1 = errMsg;
                return errMsg;
            }
            else {
                value1 = "Succes Connection To Sap B1 Hana";
                return value1;

            }
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
shahzaib
  • 49
  • 1
  • 10
  • Add the Hana instance port number onto the hostname for oCompany.Server (typically 30015). Check your license server port number (IIRC that should be 40000). Server host name has to match what's in SLD (e.g. use IP address if that's how it's defined in SLD). – Daz Sep 10 '18 at 11:07

3 Answers3

2

You must include the port number in the server. Usually, the port number is 30015.

Ander
  • 79
  • 3
0

you can also use below mention code.

SAPbobsCOM.Company oCompany = new SAPbobsCOM.Company();
oCompany = (SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany();
V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50
  • 2
    That is only valid if it is also using UI API. If it is an external application we do not have access to the Application object. – Ander May 14 '19 at 13:21
0

The following connection code should get you a step further:

// The actual database host
// With HANA the single-tenancy port 30015 needs to be provided together with the host (not so with MSSQL)
// When using HANA multi-tenancy the instance is prefixed and the port changed: INSTANCE@DB-HOST:30013
// OR the correct instance port needs to be provided, eg. DB-HOST:30017
sboCompany.Server = "DB-HOST:30015";

// The company database/schema name
// With MSSQL the instance is provided here like: INSTANCE\DB_NAME
sboCompany.CompanyDB = "SCHEMA";

// SLDServer is the new LicenseServer, don't forget the port with HANA
// Be aware: use either hostname or IP of SLD everywhere
sboCompany.SLDServer = "SLD-HOST:40000";

// Hell knows why the version needs to be provided for MSSQL...
sboCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_HANADB;

// DB credentials when using MSSQL authentication or HANA
sboCompany.UseTrusted = false;
sboCompany.DbUserName = "SYSTEM";
sboCompany.DbPassword = "password";

// SBO credentials
sboCompany.UserName = "manager";
sboCompany.Password = "password";

The next problems might be missing or wrong HANA drivers... your journey just began ;-)

boennhoff
  • 1
  • 3