Syncing local and remote database (wodSSHServer)
by Ketan, Friday, April 07, 2006, 21:04 (6815 days ago)
I have VB6 application that has local database.
Everytime local database is updated, I would like to update remote database. Also at a specified interval, the application would request for update from remote database as well. VB6 application would handle this implementation. I see some post pertaining to thread blocking by database. How to implement EXE version of tunneling component?
Could you provide or suggest implementation or components for being able to do this?
Regards,
-ketan
Re: Syncing local and remote database
by wodDrazen, Friday, April 07, 2006, 21:38 (6815 days ago) @ Ketan
Hi Ketan,
There is a problem that wodSSHTunnel and your DB connection runs in the same thread. Since your DB blocks the thread while trying to connect, wodSSHTunnel cannot process windows messages (and socket-related messages) and everything hangs.You can choose one of this four choices:
1. Setting Threading = True
2. Moving any of these 2 components in separate thread (DB if possible)
3. Setting DB to work in non-blocking (async) mode
4. Using wodSSHTunnel.EXEUsing wodSSHTunnel.EXEX it's same as COM object (just lives in separate process space).
You should also add reference to it (in VB6), initialize using 'new' keyword, and work just as it would be COM object.Hope I helped.
Regards,
Drazen
Re: Syncing local and remote database
by Ketan, Friday, April 07, 2006, 21:38 (6815 days ago) @ wodDrazen
Thanks for a very prompt response.
Let us say a local database server is listening on port 3000 and so is remote database server.
How do we setup the port at which the tunnel should be listening for routing the update to remote database server?
Regards,
-ketan
Re: Syncing local and remote database
by Ketan, Friday, April 07, 2006, 21:58 (6815 days ago) @ Ketan
Further, could you tell me whether this implementation would work?
Local Client/Server
|
V
SSHTunnel
|
V
Internet
|
V
SSHServer
|
V
Remote Client/Server
Thanks,
-ketan
Re: Syncing local and remote database
by woddrazen, Friday, April 07, 2006, 22:38 (6815 days ago) @ Ketan
Ketan,
This implementation that you ask would work you can connect to your server and use Add Method under Connected Event here is example how you should do it after you connect:
------------
Private Sub ssh_1_Connected()
SSH_1.Channels.Add LocalListen, 127.0.0.1 ,3000, your_server_address_or_address_where_server_bind , 3000
SSH_1.Channels.StartAll
End Sub
------------
When type = LocalListen then 'port forwarding' is initiated between wodSSHTunnel and the SSH server. (wodSSHTunnel listens to local sockets and forwards requests to the SSH server) so wodSSHTunnel listens on this port and accepts new connections.
More help you can find here:
http://www.weonlydo.com/SSHTunnel/Help/wodSSHTunnelLib~Channels~Add.html
You can also try first sample in category VB under Samples Folder which is part of SSHTunnel folder.
Hope I helped.
Regards,
Drazen
Re: Syncing local and remote database
by Ketan, Saturday, April 08, 2006, 22:57 (6814 days ago) @ woddrazen
I use ODBC driver in the connection string to connect to local/remote database server which listens on say port 3000.
How can I connect to remote database using SSH Tunnel?
Regards,
-ketan
Re: Syncing local and remote database
by wodDrazen, Sunday, April 09, 2006, 01:01 (6814 days ago) @ Ketan
Hi Ketan,
This code show how to connect to remote server and listen remote servers port 3000 on local port 3000.
---------------------------
Private Sub Form_Load()
Set tunnel1 = New wodTunnelCom
tunnel1.HostName = your_server
tunnel1.Login = login
tunnel1.Password = password
tunnel1.Protocol =SSHAuto
tunnel1.Port = 22
tunnel1.Connect
End Sub
Private Sub ssh_Connected()
tunnel1.Channels.Add LocalListen, 127.0.0.1 , 3000, 0.0.0.0 , 3000
tunnel1.Channels.StartAll
End Sub
---------------------------
Hope this helps.
Regards,
Drazen
Re: Syncing local and remote database
by Ketan, Sunday, April 09, 2006, 02:21 (6814 days ago) @ wodDrazen
I need some more hand holding to get going.
I used the code that you have provided.
However it comes back with the following message:
No connection could be made because target machine actively refused it .
What I have on server is the simple sample vb application provided with the server package with disconnect remarked out. I see that service request event is having a line:
ServiceType = stNone
Essentially, could you recommend how the server should be laid out for this effort to work properly?
A side question:
At any point, do Database connection need to reference the tunnel in any form?
Regards,
-ketan
Re: Syncing local and remote database
by wodAlan, Sunday, April 09, 2006, 03:02 (6814 days ago) @ Ketan
Hi Ketan,
I have a few questions.
You have on server side our wodSSHserver?
If so, what sample do you use?
So your server reflected your connection with wodTunnel, right?
Can I try to connect to your SSH server?
Regards,
Alan
Re: Syncing local and remote database
by Ketan, Sunday, April 09, 2006, 09:16 (6813 days ago) @ wodAlan
I am using SSHServer and SSHTunnel from wods.
The server sample that I am using is:
C:Program FilesWeOnlyDo.ComSSHServerSamplesVBActiveX1. Basic
The only change I made was I remarked out:
Private Sub wodSSHD1_ServiceStart(...
....
' User.Disconnect ' this isn't really very nice from us
End Sub
Regarding being able to connect into our network, I have to ask few folks and this could happen beginning next week. In the event they approve of it, how should i provide you with the hostname?
Could you recommend any other suggestions that could help in resolving this issue? I am on a tight schedule and if this prototype works, I would like to proceed with ordering this components.
Regards,
-ketan
Re: Syncing local and remote database
by wodAlan, Sunday, April 09, 2006, 14:20 (6813 days ago) @ Ketan
Hi Ketan,
Can you contact me to: techsupport@weonlydo.com ?
I get this to work with ActiveX1. Basic (wodSSHserver) and 2. Implements fast notifications (wodTunnel) samples.
I can send you my samples and you can try with them, ok?
Regards,
Alan