Derby database location – Use the --dbhome option with the start-database command to create the database at the value specified for --dbhome. For example, the following is the asadmin command syntax for start-database.
start-database [--dbhost 0.0.0.0] [--dbport 1527] [--dbhome db_directory] [--echo=false] [--verbose=false]
Location of the password.txt file – By design, the samples directory is expected to be writable since all the build commands include the creation of a password.txt file in that directory. Be sure to install a working copy of the samples in a writable location.