Closing a database

  • Follow


Greetings all!

I am very much a green newbie in the world of MySQL and thus I have what 
I expect is a simple question but have looked to find an answer without 
success.  The question is, Once a person "uses" a database, how does he 
close that database without exiting MySQL or issuing another "use" 
command?  Is there something like a "close" or "unuse" command?  I have 
not been able to find an answer to this anywhere.

Thanks in advance for the help!

--John

-- 
The person is smart.  People are dumb, panicky, dangerous animals...

-- 
Posted via a free Usenet account from http://www.teranews.com

0
Reply John 11/2/2007 8:52:54 AM

John Bevan wrote:
> Greetings all!
> 
> I am very much a green newbie in the world of MySQL and thus I have what 
> I expect is a simple question but have looked to find an answer without 
> success.  The question is, Once a person "uses" a database, how does he 
> close that database without exiting MySQL or issuing another "use" 
> command?  Is there something like a "close" or "unuse" command?  I have 
> not been able to find an answer to this anywhere.
> 
> Thanks in advance for the help!
> 
> --John
> 

No, but unless you're using transactions, just using a database doesn't 
hold anyone else up.  It's not really the same as opening a file - more 
like setting a directory to use for file operations.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

0
Reply Jerry 11/2/2007 10:58:15 AM


"John Bevan" <trali@runbox.com> wrote in message 
news:472ad987$0$12575$88260bb3@free.teranews.com...
> Greetings all!
>
> I am very much a green newbie in the world of MySQL and thus I have what I 
> expect is a simple question but have looked to find an answer without 
> success.  The question is, Once a person "uses" a database, how does he 
> close that database without exiting MySQL or issuing another "use" 
> command?  Is there something like a "close" or "unuse" command?  I have 
> not been able to find an answer to this anywhere.
>
> Thanks in advance for the help!
>
> --John
>

Hi John.

No such thing really you don't need to close.  Interesting question/thought 
though.

HTH













-------------------------------------
DSB
http://www.documentscanningbureau.com



0
Reply Mike 11/2/2007 9:42:05 PM

Mike,

Thanks for the answer.  I perceived the "use" command as if it were 
actually opening the file at the time and, thus, quitting MySQL or 
shutting down the computer without issuing a close command could corrupt 
the file.  However, from what it seems (and please correct me if my 
understanding is in error), the "use" command is more like "Assign" in 
Pascal: it assigns a filename with which file commands will be used but 
does nothing with the file itself.  Is this correct?

--John

-- 
Posted via a free Usenet account from http://www.teranews.com

0
Reply John 11/5/2007 2:21:25 AM

>Thanks for the answer.  I perceived the "use" command as if it were 
>actually opening the file at the time and, thus, quitting MySQL or 

You can view it that way.  At this point it wil check the existence
of the database and your permissions to access it.

>shutting down the computer without issuing a close command could corrupt 
>the file.  

Quitting MySQL (the 'quit' command to the command interpreter, or
mysql_close() from the C or PHP API) is a correct way to close the
database.  Another way is to switch to another database.  An unclean
disconnect (e.g. your program dumping core) will cause MySQL to
roll back uncommitted transactions.  The main opportunity for
corrupted files is to get halfway through making a set of changes,
not using transactions, then crash.

Opening a file for read, then crashing your program or the system
is unlikely to corrupt the file.  Even opening the file for write
(without truncating it), then crashing is not likely to corrupt the
file.  Half-completed changes are the main opportunity for corrupted
files.

>However, from what it seems (and please correct me if my 
>understanding is in error), the "use" command is more like "Assign" in 
>Pascal: it assigns a filename with which file commands will be used but 
>does nothing with the file itself.  Is this correct?
0
Reply gordonb 11/5/2007 3:29:03 AM

4 Replies
222 Views

(page loaded in 0.547 seconds)

Similiar Articles:













7/24/2012 6:29:40 PM


Reply: