ADO.NET/Jet connection string using SSH tunnel

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I can't find any information about how to do what my boss wants me to
figure out how to do using SSH tunnelling, wondering if anyone can help
or if anyone has done this specifically.  Right now I have the Tectia
SSH Server running on a machine on our local network - on that machine
also sits an Access database (.mdb) that I want to connect to for this
exercise.  I also have the Tectia SSH Client installed on my own pc
here on the network.  I can create a tunnel, or at least an ssh
"channel,"  using Tectia's GUI Client application just by selecting
"Quick Connect" and entering the IP address of the machine running the
SSH server, and accepting the default port of 22.

What I want to then do on the client machine, is to have a VB.NET
application connect to and manipulate the Access database on the
"server," using an ADO.NET connection string that somehow uses the
tunnel to specify the location of the database it wants to connect to.
I THINK (you'll have to forgive me for not even being exactly sure of
what I am trying to do!) that I want to be able to include a "local"
i.p. address like in the connection string (my boss tells me
you can use an i.p. address as part of the file specification in the
Jet connection string, I'm not even sure exactly the syntax of doing
that), and use port-forwarding to have the connection request actually
go to the remote (server) machine's file system (where I have the .mdb
sitting on the root of c to simplify things somewhat).  I believe the
technique is to use the C$ file-sharing syntax to refer to the root of
C:\ on the target machine, and I think what I need to do is involve
port 39 on both machines in order to have the local translate
or forward to the remote machine's ip address.

I know I will use the sshg3 command (which I understand is Tectia's
implementation of the more generic ssh command that would otherwise be
used) to turn on the port-forwarding tunnel once the channel is opened,
and I understand in a kind of an abstract way that in that command I
will specify the source and target I.P.'s and ports between which the
tunnel will be created.    But I'm stuck on exactly how to build the
command, and how I will then construct my connection string to use the

I feel confident that this can be done and probably fairly simply but I
can't find any specific instructions on how to accomplish this task.
Has anyone reading ever tried a similar use of an SSH tunnel that can
offer any help?  I am very experienced and comfortable with VB.NET
programming using ADO.NET, the Jet provider, connection string, etc;
all I need help with is setting up the port-forwarding tunnel the way
it should be and then constructing the file-path specification in the
connection string.


Re: ADO.NET/Jet connection string using SSH tunnel wrote:
Quoted text here. Click to load it

Here's some more specifics on what I want to happen and how I am going
about it so far.

I did figure out the answer to my own question about how you can
include an I.P address in the file path specification in the Jet
connection string, and saw that it does work.  For instance, if I put
my database, let's call it test.mdb, on my local c:\ root folder, then
in my VB application, I can successfully connect to it by opening my
connection object with a Connection string including this segment:

Data Source="\c$\smart.mdb";

....the connection opens successfully.  My understanding is that the c$
represents a file share on the c drive and can always be used.

....Now, what I want to do is my VB app, is use a similar connection
string to open a database on the root folder of c:\ another machine on
the network.  I can do this successfully without using an SSH tunnel,
by providing the real i.p. addresss of the remote
machine, same as above but using the local i.p. address of the other
machine instead of the "localhost" type i.p. address of
That works fine too.

Now what I WANT to be able to do, connect to that remote database over
an SSH tunnel instead, so basically the idea was to be able to use in the connection string and using the tunnel, have the
file-sharing (port 139, right?) on this machine forwarded to that on
the other end of the that\c$ would get mapped
or forwarded or translated to the (shared) c:\ folder on the other

I am able to create and open the channel and then the tunnel.  After
opening the channel in the Tectia GUI Client app, I then issued this
command in a DOS command window:

$ -sshg3 -L 139:

where the x's are the i.p. adderss of the machine running the ssh
server.  This works - after I issue the command, suddenly my command
window opens up to a folder on the remote machine, I can do dir$
commands and see the files over there in the command window, etc.

I guess this is where my understanding breaks down a bit, though.
Anyway, I then try to run my vb test app again, now I change the
connection string to say:\c$\Test.mdb....

thinking that I have port-forwarded messages coming to my local port 139 (file sharing) over to the other machine, but anyway
it doesn't work, just tells me it can't find the file.

Should this work, am I close in my approach?  I had read about a bug in
service pack 2 of Windows XP (which both computers are running under)
that prevented local i.p. addresses besides from working, but
I have applied the Microsoft hot fix to both computers, and I think I
have an updated version of the file tcicp.sys, even later than that
which Microsoft lists in their knowledge base describing this patch, so
I don't think that's the problem.



Site Timeline