in reply to Re^2: How can I get a database handler with Mojolicious::Plugin::Database
in thread How can I get a database handler with Mojolicious::Plugin::Database

If you are content with preparing them on the first invocation, you can use either ->prepare_cached or use the state keyword:

post '/invtot' => sub { state $st = $dbh->prepare(...); $st->execute(...); };