Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dr. Watson error while in pConnection->Execute ADO sample code

Status
Not open for further replies.

jax2

Programmer
Mar 27, 2001
18
0
0
US
I am attempting to use the sample code from :

I'll attach my code at the bottom. During testing, the code works fine - without error. When I put the program in production on a NT4 machine, it causes a Dr. Watson fault at different points on different machines, but does, eventually, fault. I have determined that it faults within the dbConnection->Execute() statement. The problem is that it does not happen on EACH execute. I have run 16 connsecutive executes in a rapid fire fashion, and all work, then, later... one execute with cause the fault. Any ideas/workaround ideas would be unbelievably appreciated. ANy thoughts on why the potential error is not caught by the 'try{} catch{}' block would be helpful as well.

Code:

_ConnectionPtr spBA_CON;
try{
CREATEiNSTANCE(spBA_CON,Connection);
spBA_CON->ConnectionString = L"driver={sql server};SERVER=222.222.222.222;Database=call_name;"
L"UID=sa; PWD=test=test;";
spBA_CON->Open( "", "", "", -1 );
_bstr_t bsCreateSP ("my_sp @arg1 = '" + arg1 + "', @arg2 = '" + arg2 + "'");
spBA_CON->Execute( bsCreateSP, NULL, adExecuteNoRecords);
spBA_CON->Close();
bRC = TRUE;

}
catch( _com_error &e){
_bstr_t bstrSource(e.Source());
_bstr_t bs = _bstr_t(" Error: ") + _bstr_t(e.Error()) + _bstr_t(" Msg: ")
+ _bstr_t(e.ErrorMessage()) + _bstr_t(" Description: ")
+ _bstr_t(e.Description());
MessageBox(0,bs,bstrSource, MB_OK);
}

specific crash info :
(drwatson log file info) stack traces on 2 different crashes :

crash #1 :
function: DbgBreakPoint
77f762e8 cc int 3
FAULT ->77f762e9 c3 ret
77f762ea 8bc0 mov eax,eax

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
01cbffb8 77f04ede 00000000 00131dd4 0014f8e8 00000000 ntdll!DbgBreakPoint

crash #2 :
State Dump for Thread Id 0x148

eax=80004005 ebx=0012f973 ecx=80004005 edx=7fffffff esi=7ffffffe edi=00429f37
eip=780102ba esp=0012f12c ebp=0012f380 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206


function: fcloseall
7801029f e9aafeffff jmp fcloseall+0x5e5 (7801014e)
780102a4 85c9 test ecx,ecx
780102a6 7509 jnz fcloseall+0x748 (780102b1)
780102a8 8b0d4c950378 ds:7803954c=7802f328
mov ecx,[_badioinfo+0x84 (7803954c)]
780102ae 894df8 mov [ebp-0x8],ecx ss:0102dd86=????????
780102b1 8bc1 mov eax,ecx
780102b3 8bd6 mov edx,esi
780102b5 4e dec esi
780102b6 85d2 test edx,edx
780102b8 7408 jz fcloseall+0x759 (780102c2)
FAULT ->780102ba 803800 cmp byte ptr [eax],0x0 ds:80004005=??
780102bd 7403 jz fcloseall+0x759 (780102c2)
780102bf 40 inc eax
780102c0 ebf1 jmp fcloseall+0x74a (780102b3)
780102c2 2bc1 sub eax,ecx
780102c4 e985feffff jmp fcloseall+0x5e5 (7801014e)
780102c9 c745f008000000 mov dword ptr [ebp-0x10],0x8 ss:0102dd86=????????
780102d0 c745d407000000 mov dword ptr [ebp-0x2c],0x7 ss:0102dd86=????????
780102d7 e9e7feffff jmp fcloseall+0x65a (780101c3)
780102dc f645fc80 test byte ptr [ebp-0x4],0x80 ss:0102dd86=??
780102e0 c745f408000000 mov dword ptr [ebp-0xc],0x8 ss:0102dd86=????????
780102e7 0f84f6feffff je fcloseall+0x67a (780101e3)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0012f380 7802310a 0012f398 00429f37 0012f51c 00440610 !fcloseall
0012f3b8 004161bb 0012f3e6 00429f20 0012f518 0012f914 !vsprintf
 
1. you should use hresults for each call of a COM function:
HRESULT = CreateInstance.....
if(FAILED(hr))
{
//error
//take a decision
}
so you will see which function has failed.
2. what does the computer IP mean in the database server? On one IP can be many than one DB server, so you should use its name. The server name is the same as when you connect with with SQL query Analyser.
3. See, many function require to pass SysAllocString(L&quot;...&quot;) instead of L&quot;...&quot; John Fill
1c.bmp


ivfmd@mail.md
 
by the way, see thread116-118868. I've post there a short sample on database manipulating with ADO through ATL programming interface. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top