1
I am creating a very simple java and postgresql project of clients and contacts between clients.
Exists the table clientes
with id and name, and the table contatos
with id1 and id2 which refer to customers.
What happens if in a thread with a connection you make a SELECT containing all the contacts of a given client at exactly the same time as another thread with another connection makes an INSERT or DELETE ?
And yet another case, if I have a "saved procedure" that makes several selects and different updates and two threads(connections) perform this same procedure? Is there any order guarantee ?
Grossly, if the application (outside the JDBC) does not guarantee synchronization, it is up to the DBMS to deal with it. JDBC doesn’t have the intelligence inside him to handle a lot of things. I think the most it contains is to determine whether to open a transaction, commit its result, give rollback and end the transaction. But this is not done internally, it is up to the application to make these calls. When I have a longer time, and if no one has responded satisfactorily, I come back here, I search and I send a reply
– Jefferson Quesado