@Lasith Just call http://doc.qt.io/qt-5/qsqldatabase.html#database and pass the name of your connection as parameter ("MyDB" in your example).