Hi,
1.
If you look into the Administration Module you have a flow ManageMyAccount. This has logic that does what you are looking for. So you can rewrite this flow a bit. Just make sure you have a dataview where you display the username and that the current user somehow is being passed by Datasource.
2.
Not sure what you are looking for here but Mendix comes with a database connected automatically. Locally this is your built-in database. You can also connect to a hosted db locally for your own environment. Please check this link:
https://docs.mendix.com/refguide/configuration/#database
If you want to connect to another database in your app itself there are several options. F.e.:
https://docs.mendix.com/howto/integration/execute-an-sql-statement-on-an-external-database/