Skip to Content
author's profile photo Former Member
Former Member

C++ DI connection problem SAPB1 2005 sp1

Hello,

I have a problem connecting to a simple database. The code used to work with the SAPbobsCOM67.dll (2004). Now with a fresh installation, using the demo company and with SAPbobsCOM2005.dll, it is not working. I compared my code to the available sample (no S, there is only 1 available) and it is exactly the same.

---

SAPbobsCOM::ICompanyPtr oCompany("SAPbobsCOM.Company");

oCompany->Server = (_bstr_t)strServer;

oCompany->UserName = (_bstr_t)strUser;

oCompany->Password = (_bstr_t)strPsw;

oCompany->CompanyDB = (_bstr_t)BDName;

oCompany->UseTrusted = true;

oCompany->Connect();

---

Connect() returns -111 : failed to connect to SBOCommon

then i tried without the Trusted:

---

SAPbobsCOM::ICompanyPtr oCompany("SAPbobsCOM.Company");

oCompany->Server = (_bstr_t)strServer;

oCompany->UserName = (_bstr_t)strUser;

oCompany->Password = (_bstr_t)strPsw;

oCompany->CompanyDB = (_bstr_t)BDName;

oCompany->DbUserName = (_bstr_t)BDuser;

oCompany->DbPassword = (_bstr_t)BDPassword;

oCompany->UseTrusted = false;

oCompany->Connect();

---

Now the application never returns from the Connect(), the cpu jumps to 100%, and it is slowly eating all the memory available. (around 20k/sec)

I tried with hardcoded values,

I reinstalled SAPB1,

I tried without the firewall,

I ran the application on the server,

same problem.

now the strange thing: I tried to Connect using a different language (using a basic vb script)

here's the .vbs

---

SET oCompany = CreateObject("SAPbobsCOM.Company")

oCompany.Server = "BD_SERVER"

oCompany.UserName = "user"

oCompany.Password = "password"

oCompany.CompanyDB = "SBODemo_US"

oCompany.DbUserName = "bduser"

oCompany.DbPassword = "bdpassword"

oCompany.UseTrusted = false

oCompany.Connect()

oCompany.GetLastErrorDescription()

MsgBox oCompany.Connected

---

It can connect. it is also working with the UseTrusted.

---

Anybody ever connected to an SAP B1 2005 sp1 database using c++ ?

Are there any technical differences between the VBS & C++ ways to use the COM objects ?

Could it be a bug within the dll ? how can I report it or get assistance in that case ?

Thanks!

Jo

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2006 at 10:11 PM

    update:

    I created a new project ('hello world') and only added the #import line + the code writen above.

    in the new empty project, I still get the -111 error when I try using the trusted, but I CAN connect to the database using the bduser/bdpassword.

    the new project is working with the same settings (compiling/linking).

    Let me know if you have any ideas...

    looks like i should post in a C++ forum..

    Thanks

    Jo

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Ok the problem comes from the application filename (???)

      If i build my app using the original name (lets say APP.exe), it is not working (looping in the Connect()).

      if i build my app using the original name, and THEN rename it APP2.exe, it is working.

      A firewall problem ? no it's not, I disabled the firewall and I still have the same behavior.

      Please let me know if you have an idea why this is happening.

      Thanks for your help,

      Jo

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.