4

I have SSH access to an iSeries (DB2 Database) through a firewall. I am trying yo make queries to a db in the machine using ODBC.

I have found several tables explaining what ports are used by the protocol but don't know what to do with this information. Is there any way of redirecting traffic to the ports used by odbc if I have ssh access to the machine?

http://search400.techtarget.com/answer/What-TCP-ports-are-used-by-ODBC-to-connect-to-the-DB2-400

cabe56
  • 153
  • 1
  • 1
  • 4

1 Answers1

2

So, assuming you have a database client running on your PC, then you can create an ssh tunnel that sets up ports on your PC to reflect the ports that are running on the database server. Then direct your client to query your local host. Here's how to set up the tunnel for one of the ports, say 8471:

ssh -L 8471:localhost:8471

In this case "localhost" refers to the server, not your PC. You can replace "localhost" with the server ip address if you want.

After setting up this tunnel, if you "telnet" to port 8471 on your PC, it will connect you to the database server port 8471.

You'll have to repeat this for each of the ports in the list.

You may run into a problem if the database server requires its own hostname in the connection string. If it does, you will need to trick your client into thinking that the hostname of the PC is the same as the hostname of the db server.