Error: (IM002) [Microsoft][ODBC Driver Manager]

when trying to connect

def dbcon():
    db = QtSql.QSqlDatabase.addDatabase('QODBC3')
    ok =
    if not ok: print(db.lastError().text())
    # else: print("connected")
    query = QSqlQuery(db)
    query.exec_('SELECT * FROM IMSS')

if __name__ == '__main__':
    app = QApplication(sys.argv)

keep getting output:

Error: (IM002) [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified QODBC3: Unable to connect

I searched for this driver and is not in my odbc driver manager, not sure how to add a data source to this driver

Hi @Nina_Galeana welcome to the forum. It looks like the driver is working, but it can’t find the data source you’re trying to use.

I found this StackOverflow question with more info – there are a few different answers there, which might give you something to try?

It looks like you need to define the data source in ODBC Data Source Administrator before being able to connect to it, do you have that set up?

Let me know if none of that helps, I’ll try set it up here and see if I can figure it out.

Thank you!!! will try to do what the link says!!! I hope it works