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

Heads up! You've already completed this tutorial.

Nina_Galeana | 2020-07-08 07:53:11 UTC | #1

when trying to connect

python
def dbcon():
    db = QtSql.QSqlDatabase.addDatabase('QODBC3')
    db.setHostName('xxx')
    db.setDatabaseName('xxx')
    db.setUserName("xxx")
    db.setPassword('xxxx')
    ok = db.open()
    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)
    dbcon()

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


martin | 2020-07-08 07:59:57 UTC | #2

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.


Nina_Galeana | 2020-07-08 20:20:15 UTC | #3

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


Over 10,000 developers have bought Create GUI Applications with Python & Qt!

To support developers in [[ countryRegion ]] I give a [[ localizedDiscount[couponCode] ]]% discount with the code [[ couponCode ]] — Enjoy!

For [[ activeDiscount.description ]] I'm giving a [[ activeDiscount.discount ]]% discount with the code [[ couponCode ]] — Enjoy!

Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak