views:

134

answers:

3

I'm using the above mentioned Python lib to connect to a MySQL server. So far I've worked locally and all worked fine, until i realized I'll have to use my program in a network where all access goes through a proxy.

Does anyone now how I can set the connections managed by that lib to use a proxy? Alternatively: do you know of another Python lib for MySQL that can handle this?

I also have no idea if the if the proxy server will allow access to the standard MySQL port or how I can trick it to allow it. Help on this is also welcomed.

A: 

Do you have to do anything special to connect through a proxy?

I would guess you just supply the correct parameters to the connect function. From the documentation, it looks as if you can specify the host name and port number with an arguments to connect.

Like this:

connection = connect(host="dbserver.somewhere.com", port=nnnn)
# etc..
codeape
I'm not sure, this is the first time I write code that's supposed to access stuff through a proxy. My guess was I had to provide the proxy address, kind of like you would set the proxy for a browser.
MihaiD
I suggest that you try to provide the proxy's address as the host. Ask the proxy's administrator what port number you need to connect to to forward traffic to the db server. It might be the default MYSQL port number.
codeape
I don't think this makes much sense. If I use the proxy address as the host I'm not specifying anywhere the address of the server I want to connect to. Unless the proxy is somehow set to forward a specific port to an outside server, which is obviously not the case.
MihaiD
I believe you need to figure out the network issues here first. I suggest you contact whoever is in charge of the network and explain what you're trying to accomplish.
codeape
+2  A: 

I use ssh tunneling for that kind of issues. For example I am developing an application that connects to an oracle db.

In my code I write to connect to localhost and then from a shell I do:

ssh -L1521:localhost:1521 [email protected]

If you are in windows you can use PuTTY

Macarse
+1  A: 

there are a lot of different possibilities here. the only way you're going to get a definitive answer is to talk to the person that runs the proxy.

if this is a web app and the web server and the database serve are both on the other side of a proxy, then you won't need to connect to the mysql server at all since the web app will do it for you.

longneck
They are on different sides of the proxy
MihaiD