• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

How to get multiple clients to connect to one database  RSS feed

 
Ranch Hand
Posts: 55
Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys , so I've been thinking of building a app for my college . It would be used by lecturers for many things ,ie tracking students marks and attendances.

So I'm just in the planing phase and am confused about how I would achieve a shared database for many users(educators ).

What if a user edits a entry that someone else is using at the same time ?

How would I overcome the fact that they would be able to use the system offline and online without causing issues with changes in the online database vs the local version?


Just some confusion and it probably a simple concept I don't understand or missed as a novice ...thanks for the help in advanced for all the help!
 
Saloon Keeper
Posts: 20658
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The magic word is "transactions".

Transactions are what you use to ensure the integrity of a shared database when multiple users can be updating at the same time.

Briefly, you start a transaction. Then you do your database operations. Then you commit your transaction. Until you commit the transaction, none of your changes actually take effect in the database.

If you encounter problems while doing the update, you can rollback the transaction. That cancels the transaction and discards the changes that would have been committed.

A variation on transactions is "locking". A lock is where you mark a table, record, or whatever as being held by 1 user and no one else can mess with that database resource until the lock has been released. Locks used to be the way to do things back when mainframes ran databases and databases were more primitive. These days, transactions generally rule.
 
Ray mann
Ranch Hand
Posts: 55
Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I'll look into it if I have any issue when I get to coding that modual I'll ask follow up questions here ! Or is there a decent java library for this?
 
Tim Holloway
Saloon Keeper
Posts: 20658
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JTA library provides JEE-standard transaction support. Since I use Java Persistence Architecture (JPA) under the Spring Framework, I haven't done any manual transaction service calls in a very long while.
 
No holds barred. And no bars holed. Except this tiny ad:
ScroogeXHTML - the small and fast RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!