Are you using MySQL as your database? MySQL automatically drops idle connections after a set amount of time (See the wait_timeout setting: http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout and also here: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html) If so, you can try increasing the wait_timeout value if there are extended intervals when no one accesses the server, or tweaking your connection properties to have it auto-reconnect.
Besides that, you can try configuring your pool to check connections before returning them. For e.g. on DBCP you can try the testOnBorrow/testWhileIdle settings. Note that testing a connection every time (on borrow) is expensive.
thanks for the reply.
that solution can work for me.
do you know if any error code or exception will be thrown(i am getting JDBC fail: null), so far i try to catch that event/exception so i can wait for a few seconds and re-try to pull the data.
I am not sure of the exact error code. Overall, I feel it would be better if you could configure your DB/Connection/Pool so that it never causes the exception to occur on the Java side...
thanks Ashish for your help.