All you need to do is to lock the Database on which you want to work and after working on it you unlock it by using key words defined by the tool you are using.
As far as my experience is concerned 99.9% of the times we lock the TABLE on which we want to make changes or execute some queries.
Different tools have different syntax to do this for example for MYSQL we use:
LOCK TABLES table_name [READ | WRITE]
to lock the table and when we are done working on it we unlock it by executing :
Unlock Tables