This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I understand that Deep copy (clone) will return new separate object. So I am thinking like this..
i will create a DB connection object(say dbConnection) while my application start up, and stored it in cache. After that, whenever data base connection require then i will get a clone of dbConnection and try to process further.
can you please advice, this will be a good approach?
This (most probably) is not going to work. Not all objects are cloneable. A database connection has to be established by calling the database server and it keeps some communication channel to the database open, these things from their very nature are not cloneable.
That said, a database connection might implement the Clonable interface and make sure to actually open a new connection when cloned, however I'd say no JDBC driver does so. It does not make much sense. A Connection Pool is usually used to re-use connection resources.