Is it possible to leave jdbc connection open till the app closes? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible to leave jdbc connection open till the app closes?

I want to send SQL queries from various parts of the app. Can I just create each statements separately for all methods using single open connection? Should I need to close after each query. And open again.

24th Feb 2020, 2:23 PM
Bharanidharan B
Bharanidharan B - avatar
4 Answers
+ 2
//You can close after finishing all query
24th Feb 2020, 3:26 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 2
you should close each connection after completing the query becz if you dont close op than you waste Your clinet memory and unsually your app size will be increaed.
24th Feb 2020, 7:59 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
0
But, l need to use different queries for different event handlers. I can't call all of them at once
24th Feb 2020, 3:29 PM
Bharanidharan B
Bharanidharan B - avatar
0
Okay thanks!
25th Feb 2020, 12:48 AM
Bharanidharan B
Bharanidharan B - avatar