Thanks Buddy,
Your answer helped me to look for other options. I have used the same application having database connection and without database connection. I checked it once again just opening connection and closing it. It was also working fine. That means there was no problem in connectivity. I restructured my code and in test enviornment it is working perfectly fine hopefully it will work in production environment.
Thanks a lot for valuable information. :)