It depends on how you are organising your code.I will not prefer to use any variable as instance variable, which deals with database.
Using connection,statement or resultset as instance variable means you are going to use them across method.
And it is very likely that you get unexpected result.
Let say you are sharing instance variable of connection ! and in one method you close the connection and in another method you get error because of close connection. and If you don't close connection it may be possible you forget to close connection in other method.
That is why say It totally depends how you organise your code.
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Prashant kumar Singh
Joined: Nov 04, 2006
Hi, If you are using a lot of instance variables there there will be unsafe.when multiple threads will access then there thread unsafe. So if there is most requirement of those var then declare it as instance var else as local. Regards, Prashant kumar Singh