Unix Technical Forum

Closing a database

This is a discussion on Closing a database within the MySQL forums, part of the Database Server Software category; --> Greetings all! I am very much a green newbie in the world of MySQL and thus I have what ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:29 AM
John Bevan
 
Posts: n/a
Default Closing a database

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:29 AM
Jerry Stuckle
 
Posts: n/a
Default Re: Closing a database

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
==================

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 11:29 AM
Mike
 
Posts: n/a
Default Re: Closing a database


"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



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 11:29 AM
John Bevan
 
Posts: n/a
Default Re: Closing a database

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 11:29 AM
Gordon Burditt
 
Posts: n/a
Default Re: Closing a database

>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?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:03 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com