Home » Developer & Programmer » Precompilers, OCI & OCCI » multithreaded call with Pro*C fails
multithreaded call with Pro*C fails [message #192305] Mon, 11 September 2006 14:11
bluntcoder
Messages: 1
Registered: September 2006
Junior Member
Hi all,

I have an application that was compiled for Sun using Pro*C that we have ported to BIM AIX and it is mostly working (if there is such a thing). 2 problems.

1. It seems like the SQL query buffer length can't be as high on the AIX for some reason (I had it at 30k in my code for a potentially very large query), and it was intermittently bombing in the fetch. I fixed this by lowering the val to 25k. I assume I was hitting some 32767 limit on the AIX box or in Oracle. If anyone knows about this I would be interested to hear. Here is that code:

bool CTransTable::iSelect(const string &where, const string &hint) DB_THROW
{
EXEC SQL BEGIN DECLARE SECTION;
char sqlbuf[30000];
EXEC SQL END DECLARE SECTION;

strcpy(sqlbuf, "SELECT ");

if (hint != "")
strncat(sqlbuf, ("/*+ " + hint + " */ ").c_str(), sizeof sqlbuf);

strncat(sqlbuf, (fSubUnit + ", batch_num, trans_num, trans_text "
"FROM " + fTransTableName + " ").c_str(),
sizeof sqlbuf);

if (where != "")
{
strncat(sqlbuf, " WHERE ", sizeof sqlbuf);
strncat(sqlbuf, where.c_str(), sizeof sqlbuf);
}
strncat(sqlbuf, " ORDER BY trans_num", sizeof sqlbuf);
sqlbuf[sizeof sqlbuf - 1] = '\0';

EXEC SQL PREPARE SelectStat FROM :sqlbuf;
EXEC SQL DECLARE TransCursor CURSOR FOR SelectStat;
EXEC SQL OPEN TransCursor;

return true;
}

2. More importantly, I am running multiple threads. Each user gets their own when connecting to my application, which in turn hits the 10g database. For the first user it works fine, but when I run 2 at the same time the second user causes the following core dump.

Segmentation fault in upirtr at 0x90000000194dbb0 ($t4)
0x90000000194dbb0 (upirtr+0x8) f821d6f1 stdu r1,-10512(r1)
(dbx) where
upirtr(0x11031efd8, 0x68, 0x11026a098) at 0x90000000194dbb0
kpurcs(??, ??, ??) at 0x900000001a3b7e0
kputxcmt(??, ??, ??) at 0x900000001a37eb4
OCITransCommit(??, ??, ??) at 0x900000001b1c0f4
sqlcomt(??, ??) at 0x900000002105a38
sqlnst(??, ??, ??) at 0x90000000210f218
sqlcmex(??, ??, ??, ??, ??) at 0x9000000020ffe48
sqlcxt(??, ??, ??, ??) at 0x9000000020ff4e4
Commit()(0x1102fa1d0), line 752 in "MyFile.cpp"
StartReadOnlyTransaction()(0x1102fa1d0), line 708 in "MyDBFile.cpp"

Any input would be greatly appreciated.

Thanks,

Anthony.
Previous Topic: problem about pro*c , please help me
Next Topic: getBlob - failed
Goto Forum:
  


Current Time: Thu Mar 28 13:25:09 CDT 2024