Python Forum
[PyQt] SSH port forwarding and connection to SQL Server in separate threads freezes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] SSH port forwarding and connection to SQL Server in separate threads freezes
#21
(Nov-25-2019, 09:02 PM)Denni Wrote: Okay but I first wanted to take this one bite at time and make sure we are on the same page as we move forward -- if what I provided creates a solid usable connection to an sqlite3 database on your end -- and then you can use this class to connect to your database (since I cannot duplicate that specific aspect) -- then we will have that base stuff in place -- and then can move to the next piece
Using the code you have provided I opened the connection to SQL Server database and was able to retrieve data from a table. Of course I have made some small modification (uncommenting import of SQLAlchemy and duplicating CheckConnection method so it fits SQL Server environment).

Nevertheless the connection has been established but one again I must underline that in order to do it I have created a SSH Tunnel using PuTTY and then forward the SQL Server port so the connection is to localhost:1433.
Reply
#22
Okay so can you post your MUC so I can examine it -- or is the PuTTY stuff external to your code base?
Reply
#23
(Nov-27-2019, 04:23 PM)Denni Wrote: Okay so can you post your MUC so I can examine it -- or is the PuTTY stuff external to your code base?

PuTTY is external stuff. Using your code and mine to establish ssh connection and port forwarding and then establishing connection fails. As I said in my very first post. When I am trying to establish the connection to SQL Server with SSH connection and port forwarding running in separate thread the GUI freezes.
Reply
#24
okay so how are you implementing
1) The PuTTY connection (which establishes the SSH connection to the database?)
2) The communication from the program to the database via the PuTTY connection

Also have you tested this as a standalone process without a Thread -- aka you run the program it talks to the database through PuTTY and gets a reply? Nothing complicated and no GUI just straight python

Again just trying to make sure we are on the same page and just crossing my I's and dotting my T's
Reply
#25
(Dec-02-2019, 06:51 PM)Denni Wrote: okay so how are you implementing
1) The PuTTY connection (which establishes the SSH connection to the database?)
2) The communication from the program to the database via the PuTTY connection
The connection via PuTTY established port forwarding over SSH so the in order to talk to SQL Server I need to establish connection to localhost at 1433 port (PuTTY is forwarding remote port on which SQL Server listens to localhost)

(Dec-02-2019, 06:51 PM)Denni Wrote: Also have you tested this as a standalone process without a Thread -- aka you run the program it talks to the database through PuTTY and gets a reply? Nothing complicated and no GUI just straight python
Yes I did and it works without problem. The only thing I have not tried is to establish port forwarding over SSH and then connection to SQL Server without GUI. However I guess it should also use threading.
Reply
#26
(Dec-03-2019, 01:17 PM)jan_pips Wrote: Yes I did and it works without problem. The only thing I have not tried is to establish port forwarding over SSH and then connection to SQL Server without GUI. However I guess it should also use threading.

Okay I would suggest testing this without Threading and see if it works without a hitch then share the MUC (Minimal Usable Code) you used along with the MUC version of how you plan to implement the QThread as I think you are implementing the QThread incorrectly which is no fault of your own because Qt's Documentation is currently wrong on that as it is still showing PyQt4 way versus PyQt5 way
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  GUI freezes while executing a callback funtion when a button is pressed abi17124 5 7,388 Jul-10-2019, 12:48 AM
Last Post: FullOfHelp
  [Tkinter] tkinter freezes by clicking button Zatox11 33 25,314 Apr-10-2018, 09:03 AM
Last Post: Zatox11
  Running telnet loop freezes GUI reedhallen 1 3,408 Jan-27-2018, 10:24 PM
Last Post: j.crater
  Clock freezes - wx.python glib problem strongheart 3 3,981 Oct-10-2017, 03:36 AM
Last Post: strongheart

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020