[Tutor] MySQL Connection Function

Don Parris webdev at matheteuo.org
Wed Jun 22 06:33:35 CEST 2005


On Tue, 21 Jun 2005 19:13:43 -0400
Python <python at venix.com> wrote:

 
> I like to use the following style of code.  Since there will be
> passwords, the connection strings should be somewhat protected.  Put
> them in a separate file that can be controlled.  Here's my sample code.
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
<SNIP>
> 
> Your example code seems to view getting a connection and a cursor as
> closely related.  Typically, a connection is kept for the life of the
> application process and cursors are created, used, and closed as needed.
> 
> 
I'll be tinkering with your suggestion tonight.  You're absolutely correct,
though - my view of the connection & cursor is as you say.  Thanks for
correcting my understanding.  I've gotten that impression based on the
rather brief examples used in the tutorials.  They merely give an example of
connecting to the database and closing the connection, without describing
the reality of the process.

Don
-- 
evangelinux    GNU Evangelist
http://matheteuo.org/                   http://chaddb.sourceforge.net/
"Free software is like God's love - you can share it with anyone anytime
anywhere."


More information about the Tutor mailing list