from my own experience ... you don't have to open or close the database connection ... to get started
if you extend your controller from MyController (default) you can access the db simply.
example:
var rawUsers= db.query("SELECT * from user");
or
db.insert("user",vo);
wish it could help. :)