Reputation: 1987
I understand that jdbc involved these steps
I have 2 java files one is for GUI (Swing) and another is normal Java file. I have many input fields in GUI and send them to backend file for processing using JDBC. I have many methods like this in my Java file. The problem is in each method I have to the entire steps (mentioned above) in each of these methods. As a result of this it has become slow. I wanted to optimize it making first 3 steps and final steps mentioned above only once.
How to achieve this?
Upvotes: 2
Views: 190
Reputation: 205875
In broad outline, here are several approaches, in (roughly) increasing order of complexity:
Stick with what you're doing, abstracting useful utilities as you learn. It's laborious, but it allows maximal cutomization.
Adopt a lightweight JDBC helper library; several are cited here.
Dive in and learn the Java Persistence API.
It's entirely possible to do the first while exploring the second or third.
Upvotes: 1
Reputation: 2112
Sounds like you need a Connection Pool
. There are lots of questions related to connection pooling on Stack Overflow - there's even a tag for it!
https://stackoverflow.com/questions/tagged/connection-pooling
Upvotes: 3