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.

The complete guide to packaging Python GUI applications with PyInstaller.
[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]

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


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

Error: (IM002) [Microsoft][ODBC Driver Manager] was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.