aspose file tools*
The moose likes JDBC and the fly likes Serializability and recoverability Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Serializability and recoverability" Watch "Serializability and recoverability" New topic
Author

Serializability and recoverability

Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
Hi,

How can I implement serializability and recoverability in my java application. This is a JTable that is going to be run by several users who will read, insert, update and delete records from the database concurrently.

Thank you

Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
This is a quote from http://en.wikipedia.org/wiki/Concurrency_control. "A DBMS also guarantees that no effect of committed transactions is lost, and no effect of aborted (rolled back) transactions remains in the related database." I guess the database management system -in this case mysql- will have to support recoverability when I begin, write , rollback and end transactions in the program. Does that seem correct?

On the other hand, distributed serializability; which should be also supported by mysql in the cloud, does it require to be specified by me with appropriate code in the application? In other words; do I need to state in the program that the application will be used concurrently and therefore should use serializability?

Thank you
Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
I guess I am try to sort out how to deal with the dirty read problem: Transactions read a value written by a transaction that has been later aborted. This value disappears from the database upon abort, and should not have been read by any transaction ("dirty read"). The reading transactions end with incorrect results. Should I implement this mechanism from the java code? or should this mechanism be already in place in the dbms (mySQL)?

Thank you
Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
Would it be correct to say that the application's programmer has to code the transactions and the dbms has to support the transactions with serializabilit and recoverability?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18152
    
    8

In general the database is supposed to take care of that sort of thing. You would find it essentially impossible to implement it yourself in Java code, at least within the framework of JDBC. (That would be a prime example of "reinventing the wheel".)

So no, you are just supposed to tell the database (via the JDBC driver) whether you even want to use transactions, and if you do then how you want to handle concurrency. Check out the API documentation for the Connection interface and in particular the various overloaded createStatement and prepareStatement methods.

It's also possible that there are JDBC driver parameters which you can use to provide information about how you want to handle concurrency; those would be driver-dependent.
Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
Thanks a lot!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Serializability and recoverability
 
Similar Threads
non functional requirements
Serialization and Resultset
Doubt abt Serializable,Set,Cloneable Interface
Serializable
can we serializa a class having native methods