I am currently working with a web service that will be working with database. I've been provided with a seperate class to work with the database from my team. The question is that I want to open the connection when the service is called and then close it when the service ends. Is there some way to specify onLoad and onUnload events for the service? I dnt want to call methods to do this everytime a method is called.

Used language is what matters at the moment. If you are using Java then you should look into connection pooling libraries

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.