mysql - Do I need to close a database connection in a short python script? -


What dragon (version 2.7, 3.3) closes the database connection immediately after a program finishes?

For example:

  Import MySQLdb conn = sqlite3.connect (host = "localost", user = "adam", password = "12345", db = "My_db") c = conn.cursor () c.execute ('SELECT * FROM MY_TABLE' '') cur.close () # Do I really need it? Conn.close () # Do I really need it?   

If I could have a problem with shutting down the connection to run this script again once again?

ps Yes, I know that the best practice is to stop all the resources.

As you have said that you should close the connection to your code explicitly < P> SQLite will return any open transaction for example.

In addition to this I have read somewhere you can use the statement with when you are using MYSQL, Google may be worth googling.

Comments

Popular posts from this blog

c# - Roxy file manager in MVC doesn't accept session path -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

java - Ajax call to jsp and jsp redirecting to further jsp -