A database can be opened in locked mode with the SQL statement
DATABASE dbname EXCLUSIVE
but in an interactive session you will first have to close the current database. I presume in an application you can make multiple connections to databases and lock them with this statement. Keep in mind that for opening a database in locked mode no other connection to that database may exist at the time.