To be done in one method (in a class) and other methods should use this connection object inside.Is it possible to do something like this.Hope that you got my question correctly. A reply would be appreciated. Thanks AS Also adding, What will be the return type of a method that will return a connection.Let me know thanks
Have a look at using a DataSource instead (if you're using an aplication server) or use a ConnectionPool otherwise. (the ConnectionPool is usually hidden behind the DataSource in app servers. You get it for free) They both allow you to put all the other 'stuff' elsewhere and just serve Connections.