We help IT Professionals succeed at work.

Sybase ,Cursors, ODBC Drivers 15.0.3

864 Views
Last Modified: 2013-11-25
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
Comment
Watch Question

Joe WoodhousePrincipal Consultant
CERTIFIED EXPERT
Most Valuable Expert 2012

Commented:
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?
rbhargawFounder

Author

Commented:
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
rbhargawFounder

Author

Commented:
reattaching
SybaseConn.bmp
rbhargawFounder

Author

Commented:
may be send your email..I will send the snaps, I tried several options but the attached pic is not clear
Principal Consultant
CERTIFIED EXPERT
Most Valuable Expert 2012
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Joe WoodhousePrincipal Consultant
CERTIFIED EXPERT
Most Valuable Expert 2012

Commented:
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. :)
rbhargawFounder

Author

Commented:
Thanks Joe for the information!In case I need more info I will open new ticket.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.