D
D. Xenakis
Im using python 3.3 on win7 64bit and trying to connect to a MySQL database on a remote server through a putty ssh tunnel.
Running the script below im getting "Physical connection to the database did not activate!". What im i doing wrong?! I tried to find a working example but couldnt find one. thx in advance guys
from PyQt5 import QtSql
def main():
db = QtSql.QSqlDatabase.addDatabase("QMYSQL")
db.setHostName("127.0.0.1")
db.setPort(3306)
db.setDatabaseName("username_databasename")
db.setUserName(username)
db.setPassword(userpassword)
ok = db.open()
if ok:
print ("Physical connection to the database activated")
else:
print ("Physical connection to the database did not activate!")
return
create_table(db)
db.close()
main()
Running the script below im getting "Physical connection to the database did not activate!". What im i doing wrong?! I tried to find a working example but couldnt find one. thx in advance guys
from PyQt5 import QtSql
def main():
db = QtSql.QSqlDatabase.addDatabase("QMYSQL")
db.setHostName("127.0.0.1")
db.setPort(3306)
db.setDatabaseName("username_databasename")
db.setUserName(username)
db.setPassword(userpassword)
ok = db.open()
if ok:
print ("Physical connection to the database activated")
else:
print ("Physical connection to the database did not activate!")
return
create_table(db)
db.close()
main()