Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

Python 3.3 + QtSql + ssh tunnel - Connection problem

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


gouzounakis at hotmail

Aug 10, 2013, 4:32 AM

Post #1 of 1 (14 views)
Permalink
Python 3.3 + QtSql + ssh tunnel - Connection problem

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()
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.