Connecting to SQL Server with pyodbc over VPN - vpn

I have some code that establishes a connection to SQL server using pyodbc. However, soon the SQL server will only accept connections from a VPN. I need to therefore modify the connection to go via a VPN.
How can I achieve that pyodbc?

The VPN connection will need to be established first, this isn't a problem that can be solved directly by pyodbc.

Related

Using interconnect search-replace wordpress migration tool on Google CloudSQL

I recently migrated a site to a new server and am now trying to replace the old domain by the new one using this tool suggested in the wordpress codex.
The SQL instance and the VM are both in the same region and are connected using a cloud sql proxy, however when I try and connect to the database via the searc-replace tool, I get connection refused:
EDIT:
The command used to start the sql proxy is the following:
localhost:/cloudsql/project-name:region:sql-instance-name
It is the same I use in the config file to connect the site to the db.
"Connection Refused" error occurs when an application attempts a TCP connection but there is either no service listening on the target address and port or a firewall rejecting the connection.
First, lets make sure you are connecting on the right port. Run sudo netstat -lntp and look for cloud_sql_proxy. For example you might see
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 71313/cloud_sql_pro
indicating cloud sql is listening on port 3306. If you saw this, you should change the port in your tool to 3306.
If netstat does not show any cloud_sql_proxy line, then it isn't listening on TCP. While TCP isn't always needed for MySQL, it looks like the tool your are using does need it. Make sure you start cloud_sql_proxy with -instances=<INSTANCE_CONNECTION_NAME>=tcp:3306
Second, lets make sure you are connecting on the right address. This should be localhost without :/cloudsql/project-name:region:sql-instance-name after.
If it still doesn't work after those two, use sudo iptables -L to look for firewall rules blocking the traffic. I believe it's unlikely that you have a firewall stopping local traffic, however.
An alternative to using the Cloud SQL Proxy is to connect directly to your instance. To do this:
Find the external IP address of the VM you are running the PHP tool on.
Grant access for that IP address to your SQL instance, with the instructions here
Because MySQL can have different username/password depending on where you connect from, ensure there is a username/password combo for host %. instructions here.
Use the tool, with the username/password from (3), port=3306 and host=the IP address of your SQL instance
When you are done, remove access from the IP address to your Cloud SQL instance.

Connected to VPN Unable to Connect to Server Connected to different VPN

I am Connected to our VPN and I would like to RDP to a Server that is on the network that is currently connected to a different VPN. What do we need to do? If I RDP to a different server and then RDP from that server to the one connected to a different VPN, it works. I just can't directly. Is there something that we need to set up on that server, my computer or the network?
Actually you can be connected to other remote server as well with your machine as VPN client so now will be vpn client to two different vpn server
for doing this you need to perform following steps
1.Create a new client1.conf file for the new remote server
2.copy the content of already present client.conf to client1.conf file
3.now change the value of ca, cert and keys in client1.conf file to the respective values as per to those needed to connect other remote server
4.establish vpn connection with other remote server as follows
openvpn client1.conf
The command used above are for linux to establish vpn using openvpn, For windows, please find same command for windows from openvpn site might be client1.conf in linux corresponds to client1.opvf or something... However this would be the step to be performed in general

godaddy.com db connect to sql server studio management Error 53

I want attach my local MS SQL db to www.godaddy.in server can anyone suggest me how i can attach my db. Or how i can connect my sql server 2008 studio management to www.godaddy.in server. when i'm trying to connect my sql server studio management to www.godaddy.in server it's not connect showing Error
(Provider: Named Pipes Provider, error:40, and microsoft sql server error 53)
https://social.technet.microsoft.com/wiki/contents/articles/2102.how-to-troubleshoot-connecting-to-the-sql-server-database-engine.aspx
http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx
https://stackoverflow.com/questions/11278114/enable-remote-connections-for-sql-server-express-2012
Short Answer
Check Firewall
Check Service is Running
Check TCP/IP is Enabled
Check SQL Server Properties "Allow Remote Connections"
Then Run these if Those Do not Resolve
Right-click on TCP/IP and select Properties.
Verify that, under IP2, the IP Address is set to the computer's IP address on the local subnet.
Scroll down to IPAll.
Make sure that TCP Dynamic Ports is blank.
Make sure that TCP Port is set to 1433.
If you have a named instance then you must have the SQL Server Browser Service enabled
The browser service runs on port UDP 1434 and this must be allowed through your firewall
Hail Mary Pass if this is Still not Resolved
Go to the client machine, and run cliconfg.exe If named pipes is listed first, demote it, and promote TCP/IP.
check if the firewall is blocking the named pipes port, which usually is 445

telnet to a port fails: fuzzy on basic network theory

When some network connection isn't working right, one thing in my bag of tricks is to try opening a telnet connection to it. I don't expect to be able to do anything useful with this connection, but knowing if I can or can't connect is helpful in diagnosing the problem.
So today we had a problem where our app server couldn't open the JDBC connection to our database. However, it works fine when the app server is on the same physical box as the database. Aha, I thought, there must be a firewall blocking that port. So I tried to telnet to that port, and couldn't connect. As a control though, I also telnetted to a database on a box we could connect to and that failed as well. So, the situation is, somehow whatever is listening on that port accepts a JDBC connection from JBoss, but rejects a connect from telnet. How does it distinguish these two connections? Different protocol? Password embedded in the connection request?
Sounds like the database is only accepting connections on the local interface. Is your app server configured to connect to the database via its IP or via either localhost or 127.0.0.1?

windows 7 dbc connection sqlanywhere 11

I'm trying to connect from my ms windows 7 via the odbc administrator to a remote
sybase sqlanywhere 11 database server.
But I get not connection, I'm not sure which configure option I have to specify.
server-name = ip address of remote database server?
startline ?
portnummer ?
Thank you, best regards, Alex
By default the SQL Anywhere server process dbsrv#.exe listens for incoming connections on port 2638.
Make sure your firewall allows outbound connections to that port.
Assuming you have a database running on your server as follows:
-x tcpip
-n my_server_name
"[DIR]\database_main_file.db" -n my_database_name
The server will broadcast on the tcp/ip layer on the default port (2638) under the name "my_server_name" and the database will be accessible under the name "my_database_name" via ODBC
Creating an ODBC entry for your new database to connect from a client (adjust for Windows 7)
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\myodbcentry]
"Driver"="C:\\PROGRA~1\\SQLANY~1\\Bin32\\dbodbc11.dll"
"DatabaseName"="my_database_name"
"ServerName"="my_server_name"
"LINKS"="TCPIP(IP=SERVER_IP_ADDRESS;PORT=2638)"
There are other parameters available for LINKS (HOST, etc). Take a look at http://dcx.sybase.com/index.html#1101en/dbadmin_en11/da-using-tcpip.html
I've seen some rare issues with UDP broadcast packets. See the docs at
http://dcx.sybase.com/1101en/dbadmin_en11/broadcastlistener-connection-conparm.html and check with your network administrator.
You can also use the dbping.exe utility to troubleshoot networking issues.
BTW, you may want to cross-post your question at http://sqla.stackexchange.com. It's full of SQL Anywhere buffs

Resources