Take a look at this
thread in which Rob Mayoff gives a definition of maxopen & maxidle. As discussed
here, setting maxopen and maxidle to 1000000000 essentially prohibits Aolserver from ever releasing a database handle and seems to be the frequent workaround of database & db driver bugs.
However, this is a kludge. While it may allow things to "work", you probably need to fix the underlying problem. Why is authentication failing the second time and not the first?