OK, this might not be a beginning
Java question. I am new to the forum and i apologize if this is not the correct place for this question.
Application gets a message from sender application.
opens a oracle db connection and stores the connection in threadlocal varaible
calls a whole bunch of classes passing the threadlocal variable to do some things to the data and store it in a oracle array
then continues to get more messages one at a time and does that same thing until it gets a commit messages from sender
when the whole set of array does a bunch insert to db
and releases the
thread. and resets the threadlocal variable.
Now i saw multiple online didcussions on how threadlocal variables are not a recommended way to keep the db connection
and instead we should be using
jdbc connection pool.
what i dont understand is, the jdbc connection pool is available and the threadlocal variable is merely getting a connection from the pool
and returning it back to the pool when it is done doing what it does.
i dont know what people mean when they say use jdbc connection pool instead
Also, do you guys think the above approach to handle db connections is a good way to go about this?
Any other better ways this could be done. I saw a forum where they recommend using Hibernate.
Please share your thoughts.
thanks.