shahzaib
shahzaib

Reputation: 49

Connect Sap B1 hana with C# Application using DI API

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;

            }

Upvotes: 2

Views: 7222

Answers (3)

boennhoff
boennhoff

Reputation: 1

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 ;-)

Upvotes: 0

Adeeb Ul Hassan
Adeeb Ul Hassan

Reputation: 1

you can also use below mention code.

SAPbobsCOM.Company oCompany = new SAPbobsCOM.Company();
oCompany = (SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany();

Upvotes: 0

Ander
Ander

Reputation: 79

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

Upvotes: 2

Related Questions