Re: closing statements when connection is closed
От | Iain |
---|---|
Тема | Re: closing statements when connection is closed |
Дата | |
Msg-id | 009d01c3ef91$e1cbebc0$7201a8c0@mst1x5r347kymb обсуждение исходный текст |
Ответ на | closing statements when connection is closed (Dave Cramer <pg@fastcrypt.com>) |
Список | pgsql-jdbc |
I'm no expert on this, but leaving statements open uses memory as I understand it, so if you open new statements instead of re-using them then you should close them. In my case I just wrote a batch pupdate process that runs in about 30 minutes and then exits, so all statements will be closed and memory returned at the time the process ends, but I close them anyway. If your app is intended to run for long periods of time and you are concerned about memory leakage, then you should probably close statements and connections every time you finish with them. Someone wrote that you should clear warnings regulary too, as they can consume memory in long running apps that re-use statements. That makes sense to me. The problem I had with my app was deciding what to do when there was an error. I tried putting calls to the close() method in the catch(SQLException ) block but the compiler complains about it. If anyone has any ideas on that I'd like to hear them. regards Iain ----- Original Message ----- From: "Dave Cramer" <pg@fastcrypt.com> To: <pgsql-jdbc@postgresql.org> Sent: Tuesday, February 10, 2004 1:16 PM Subject: [JDBC] closing statements when connection is closed > It would appear from the documentation that we are supposed to clean up > JDBC resources when Connecton.close is called, would this include > statements. We currently don't track them or clean them up? > > Opinions ? > > -- > Dave Cramer > 519 939 0336 > ICQ # 14675561 > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org
В списке pgsql-jdbc по дате отправления: