on 09-05-2006 7:13 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in a new project, i can.
in the project i'm working with, it won't work; to make sure it is not a problem in my code, I created a simple button on the main dialog and cut & pasted the sample code. Still get the same error.
My application uses many COM objects without problem. It is the first time I see something like this. I will update this post if I find something.
Thanks
This is the import:
#import "C:\Program Files\SAP\SAP Business One\DIAPI\2005\SAPbobsCOM2005.dll" rename_namespace ("SAPbobsCOM")
and I deleted everything in the SM_OBS_DLL dir.
I don't know if this can help, but here is the Connect() debug output of both project (Usetrusted=false).
the 1rst one enters in a loop, the 2nd returns 0 (connected). The code and the #import are identical (cuted and pasted).
---
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\ObserverDLL_680317.dll', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_PORTABLESERVER2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_OBJREFTEMPLATE2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_VALUETYPE2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_IORINTERCEPTOR2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\OBS_EnginesResource680317.dll', no matching symbolic information found.
First-chance exception in app.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
---
Now this is the <working (new) project> :
---
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\ObserverDLL_680317.dll', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_PORTABLESERVER2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_OBJREFTEMPLATE2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_VALUETYPE2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_IORINTERCEPTOR2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\OBS_EnginesResource680317.dll', no matching symbolic information found.
First-chance exception in TestSAPB1.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
Loaded 'C:\WINDOWS\system32\dbnetlib.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wsock32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\security.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ntdsapi.dll', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\NamingServiceWrapper.dll', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_COSNAMING2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_SVC_UTILS2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_IORTABLE2005.DLL', no matching symbolic information found.
Loaded 'C:\Documents and Settings\user\Local Settings\Temp\SM_OBS_DLL\680317\TAO_MESSAGING2005.DLL', no matching symbolic information found.
The thread 0xB08 has exited with code 0 (0x0).
The thread 0x9E0 has exited with code 0 (0x0).
The thread 0xE8C has exited with code 0 (0x0).
---
Thanks
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
User | Count |
---|---|
97 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.