Link to home
Start Free TrialLog in
Avatar of rbhargaw
rbhargawFlag for United States of America

asked on

Sybase ,Cursors, ODBC Drivers 15.0.3

Hello Experts,

I have a VC++ MFC application which uses Sybase ODBC connection. While using the Sybase 15.0.3 drivers, I am noticing few things. Basically when I open an CDatabase Recordset object in MFC code, it opens an cursor one with some ID and one with 0. If you notice under lock class, cursor ID is same for the object name.

Once I close the connection I am able to get rid both the cursors( 0 and with some ID) but need to know as to why this peculiar behaviour..

Can any one check the snapshot and give me a clue as to what exactly is happening?

I have attached the snapshot of Database Monitor.
Sybase.bmp
Avatar of Joe Woodhouse
Joe Woodhouse

I can't really read that output, a screen cap doesn't hold its resolution well when you zoom in enough to read it. I think you might mean the "0"s appearing in the "Lock Page" column though?

If so, this is entirely correct and expected. Whenever a process holds a page- or row-lock in a table, we also see a corresponding "intent lock" at the entire table level. because it is on the entire table, it isn't considered to be on any particular page or row, and so it shows up as page 0.

An intent lock is a fast way of signalling "someone has this kind of lock somewhere inside me". Suppose I need an exclusive table lock on a table. It would be a nuisance (and much slower) to have to examine every kind of finer grained lock for compatibility. But if each of them also puts an intent lock on the table as a whole, I can instantly see whether this will work. An exclusive table lock is not compatible with *any* intent lock, because any intent lock means someone is doing something somewhere to one or more of this table's rows/pages, and therefore I cannot lock the table exclusively. Likewise if I want a shared table lock, if I see any exclusive intent locks I know it won't work, but if I see only shared intent locks it will.

... unless you mean a different "ID 0" which I can't make out in your screen shot?
Avatar of rbhargaw

ASKER

Please check the snapshot and let me know if you can read it....If you check the under object_name e.g. Bizent, the same cursor ID is used in Lock class but one has  lock page as "0" and another has lock page 49913..Is that fine ??

What if I try to insert,update the bizent table outside the application at the same time? It did work but sometimes it fails.

I have attached one more snapshot which has a sh_page-blk under "Sybaselock.bmp" which happened when I tried to insert a row in product table through DBArtisan interface and application was also open with the cursor locks.

Let me know what things I should take care of.
SybaseConn.JPG
Sybaselock.bmp
reattaching
SybaseConn.bmp
may be send your email..I will send the snaps, I tried several options but the attached pic is not clear
ASKER CERTIFIED SOLUTION
Avatar of Joe Woodhouse
Joe Woodhouse

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No need, I can see enough to figure out all the lock page 0s for cursors are intent locks, look at the lock type column. :)
Thanks Joe for the information!In case I need more info I will open new ticket.