SQL connect to port, which is not opened...
-
Well, here I am...again... I have got this issue:
I am connected to IP (localhost) with a specific port, let it be 33054 (on Linux). Although I am connecting to port 33054, which is closed, it connect to it!...
Database driver: MySQL, the newest Qt...The code:
@
class DB:
tables = {}
tables['admins'] = "admins"userdata = {} error_msg, error_code = (None, None) database = (None, None) def __init__(self): self.db = QSqlDatabase.addDatabase("QMYSQL") self.db.setUserName("root") self.db.setPassword("pwd") self.db.setDatabaseName("schp") def setState(self, code, msg = None): """ Sets result code / error code of last action """ self.code = code if code == 0: self.error_code = None self.error_msg = None else: self.error_code = code self.error_msg = msg return code # # ---------------------------------------------------------------------------------------------- # DB CONNECT AND LOGIN # ---------------------------------------------------------------------------------------------- # def connect(self, server): self.db.setHostName(server) self.db.setPort(33054) print self.db.port() ok = self.db.open() print self.db.lastError().databaseText() if ok: print "Connected to", server else: print "Error while connecting to the server", server return ok
@