I want to create a database connection programmatically without using the config file. I have a form wherein the user enters the database details like the hostname,
I realised my mistake. When using Yii::$app->set() for setting up the db connection, you have to even manually open the connection using Yii::$app->db->open(). Yii doesn't open up the connection for you.