You can obtain DB by visiting the Berkeley DB download page: http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html.
        To install DB, untar or unzip the distribution to the directory of
        your choice. You will then need to build the product binaries.
        For information on building DB, see 
            DB_INSTALL/docs/index.html,
        where DB_INSTALL is the directory where you unpacked
	    DB. On that page, you will find links to platform-specific build
        instructions.
    
That page also contains links to more documentation for DB. In particular, you will find links for the Berkeley DB Programmer's Reference Guide as well as the API reference documentation.