I measure connect like this:
log.warn("After (DataSource)ctx.lookup"); //log datetime before connect
Connection conn = datasource.getConnection();//here is problem - I wait, wait, wait
log.warn("After datasource.getConnection()"); //log datetime after connect
After a few minutes the connection is successful. I don't have any fails.
DB server locate on the same network.
So it really depends on how many rows your test.testl table contains
This table (test.test1) contains just one row.
But is strange for me that
when I stop in browser then connection,
and after that I connect second time - I get the connection immediately.