If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to I lock a whole database?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-27-04, 10:07
sjl301 sjl301 is offline
Registered User
 
Join Date: Feb 2004
Location: London England
Posts: 8
How to I lock a whole database?

Hi,

I'm building a mysql database which is accessed via JDBC. The database can have many users, but I want to simplify it by only allowing one user to connect to the database at a time. My Java application creates and holds onto a connection until it exits. I just need to know how to lock the whole database whilst somebody is connected! Any ideas?

Cheerz,

Steve.
Reply With Quote
  #2 (permalink)  
Old 03-01-04, 15:43
sjl301 sjl301 is offline
Registered User
 
Join Date: Feb 2004
Location: London England
Posts: 8
The best solution i've come up with is to change th mysql system variable max_connections to 0 which only allows one person access at a time.
If anybody knows of a better solution then let me know!!
Reply With Quote
  #3 (permalink)  
Old 03-02-04, 03:40
calum433 calum433 is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen
Posts: 12
I have set up two user accounts, an admin one which only I use and a general one which is used by everything else. Then when I wish to lock the database I drop the general account. When I wish to unlock the database, I recreate the account.

Anyone else got other ways of doing it?
__________________
Calum
www.4-3-3.com
Online football Management Game
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On