• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Cookie value used in DBAccess Interface

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I've a questions related to cookie

// Locks a record so that it can only be updated or deleted by this client.
// Returned value is a cookie that must be used when the record is unlocked,
// updated, or deleted. If the specified record is already locked by a different
// client, the current thread gives up the CPU and consumes no CPU cycles until
// the record is unlocked.
public long lockRecord(long recNo)
throws RecordNotFoundException;



What Sun is trying to mean about cookie here in this interface. Are they trying to mean like this :
"returned value is a cookie which is nothing but it's same as magic cookie value in database file ()" ?
or
we have to randomly generate cookie value for each lock and the same generated must be used while performing other tasks like unlock/delete/update?

Thanks in advance,
Seetha...
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll think you'll be able this question yourself, if you have a clear understanding of the lock-method itself. In ScjdFaq there is an excellent explanation of the purpose of this method.
 
Seetharaman Iyer
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Roel, my question is not about the usage/functionalities of these methods . My concern is all about the cookie value which will be used in the method invocation.

The doc says :



Is this cookie value same as magic cookie value specified in the database file(first 4 byte numeric)?

Please clarify...
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you know the purpose of the lock and unlock methods, you'll be able to answer the question yourself. If you have read the ScjdFaq (as I suggested) you would also have read that the magic cookie is just used to identify database files.
 
Onion rings are vegetable donuts. Taste this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic