Sorry for the English.
I mean, when building my applications, I often need to do several
database actions, and I'm thinking, what's better?
1) Open connection with DB, for instance mySQL, at beginning and close
at the end, so every "unit" in the code knows that THIS IS the
connection, and its opened.
OR
2) Every "unit" in the code opens and closes DB connection
independantly.
I mean, when building my applications, I often need to do several
database actions, and I'm thinking, what's better?
1) Open connection with DB, for instance mySQL, at beginning and close
at the end, so every "unit" in the code knows that THIS IS the
connection, and its opened.
OR
2) Every "unit" in the code opens and closes DB connection
independantly.
Comment