Nina_Galeana | 2020-07-08 07:53:11 UTC | #1
when trying to connect
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.
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
Packaging Python Applications with PyInstaller by Martin Fitzpatrick — This step-by-step guide walks you through packaging your own Python applications from simple examples to complete installers and signed executables.