Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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!
 
Bartender
Posts: 19976
95
Android Eclipse IDE Linux
  • 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
Bartender
Posts: 19976
95
Android Eclipse IDE Linux
  • 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.
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
Download Free Java APIs to Work with Office Files and PDF
htttp://www.e-iceblue.com/free-apis.html
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!