Database connections
Egbert Bouwman
egbert.list at hccnet.nl
Thu Sep 23 05:35:18 EDT 2004
More information about the Python-list mailing list
Thu Sep 23 05:35:18 EDT 2004
- Previous message (by thread): Database connections
- Next message (by thread): Question: How efficient is using generators for coroutine-like problems?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
My aim is to develop a policy for database connections and commits, however I do not fully understand these phenomena, and any comment is welcome. I use postgres with psycopg. The essence of my program is to do operations on a specific database, so I need a connection all the time. The program may run for hours or even days. Why not. I can start a connection at the beginning of the program, and close it at the end. Or I may do it as a class-level instruction in the class that is responsible for the database operations. So it is executed only once, at the first import. But it gives an insecure feeling. Connections may break down, and intruders may misuse them. I can test if the connection still exist before I do a real transaction. How do I test, if not with some dummy execute ? The alternative is to open and close a connection immediately before and after each transaction + commit. Is that a too defensive way of life ? egbert -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 ========================================================================
- Previous message (by thread): Database connections
- Next message (by thread): Question: How efficient is using generators for coroutine-like problems?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list