How to send response when a method call not responding

Hi all,

I have a situation where in servlet, i need to send the respond within 45 secs...

due to some reasons... at times a getConnection() method doesnt respond till 2 mins... when after getting the connection i need to do some inserts.. i used timer and persisted the data in a flat file if not getting connection for more than 4 secs and stopped insertion..

can anyone suggest me an alternative coz i need to send a response back in case i dont get connection from getConnection() mthod....

[518 byte] By [anuragsetiaa] at [2007-10-3 0:20:25]
# 1
I assume that you mean the getConnection method of the JDBC DriverManager. You can set the setLoginTimeout to a value. You may also want to think about using connection pooling.
tolmanka at 2007-7-14 17:11:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

> I assume that you mean the getConnection method of

> the JDBC DriverManager. You can set the

> setLoginTimeout to a value. You may also want to

> think about using connection pooling.

we have a timeout set in our datasource

and v r also using connection pooling as u might hv figured

just that the timeout is 120 secs and our portal timeout is set to 45

and in case we dont get a connection within that time... or say 5 secs

i intend to bypass the connection code and just persist the values and send back a positive response to the user

the flat file i m persisting is later on being updated in the db

anuragsetiaa at 2007-7-14 17:11:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

> > I assume that you mean the getConnection method of

> > the JDBC DriverManager. You can set the

> > setLoginTimeout to a value. You may also want to

> > think about using connection pooling.

>

> we have a timeout set in our datasource

> and v r also using connection pooling as u might hv

> figured

>

> just that the timeout is 120 secs and our portal

> timeout is set to 45

> and in case we dont get a connection within that

> time... or say 5 secs

> i intend to bypass the connection code and just

> persist the values and send back a positive response

> to the user

>

> the flat file i m persisting is later on being

> updated in the db

Does anyone have a solution for this ...

anuragsetiaa at 2007-7-14 17:11:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...