Add conditions to resolve BDB 4.6 compatibility issues.

Successfully compiled and works with BDB 4.6.