freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] MAMP, FreeTDS, ODBC, and ssh tunnel port forwarding almost working...
- From: Randy Syring <randy AT thesyrings.us>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Cc: andrew AT bluehousegroup.com
- Subject: Re: [freetds] MAMP, FreeTDS, ODBC, and ssh tunnel port forwarding almost working...
- Date: Mon, 15 Sep 2014 10:27:10 -0400
Andrew,
This isn't really a FreeTDS issue. The error you posted shows the problem, the client can't connect to the server, probably due to the network hoops you are having to jump through.
You will likely get more timely help from something like stackoverflow.com or serverfault.com.
P.S. I find it surprising that you would create an SSH tunnel directly to the MSSQL server IP given that the server must be running windows. Maybe I'm naive, I just didn't realize you could do that.
*Randy Syring*
Husband | Father | Redeemed Sinner
/"For what does it profit a man to gain the whole world
and forfeit his soul?" (Mark 8:36 ESV)/
On 09/14/2014 09:44 PM, Andrew Rousseau wrote:
I am attempting to connect with php to a remote mssql server. Since the
mssql server is behind a firewall, I am using ssh tunnel with port
forwarding to access it from my Macbook.
$ ssh -N -L 1433:<mssql_server_ip>:1433 username AT www.example.com
The tunnel works fine as I am able to use Navicat to connect to the mssql
server and I am able to telnet to it. I think I have freetds and odbc
installed correctly and running under MAMP locally. It is only php that is
unable to connect to the server. Which leads me to believe that there is
some small piece of my configuration that is causing it to fail. I also am
thinking that the tunnel and port forwarding may be an issue for freetds.
>From php I am attempting to connect the same way I am successfully
connecting on my linux production server:
$db = new PDO('odbc:Driver=FreeTDS; Server=127.0.0.1; Port=1433;
Database=db_name; UID=user; PWD=password;');
Here is the output of a tdsdump:
$ TDSDUMP=/tmp/freetds.log TDSVER=7.1 tsql -H 127.0.0.1 -p 1433
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20009 (severity 9):
Unable to connect: Adaptive Server is unavailable or does not exist
OS error 61, "Connection refused"
There was a problem connecting to the server
$ tail -f /tmp/freetds.log
log.c:196:Starting log file for FreeTDS 0.91
on 2014-09-14 21:36:55 with debug flags 0x4fff.
iconv.c:330:tds_iconv_open(0x7fb50bc04250, UTF-8)
iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
iconv.c:187:local name for UTF-8 is UTF-8
iconv.c:187:local name for UCS-2LE is UCS-2LE
iconv.c:187:local name for UCS-2BE is UCS-2BE
iconv.c:349:setting up conversions for client charset "UTF-8"
iconv.c:351:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:391:preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion
iconv.c:394:tds_iconv_open: done
net.c:205:Connecting to 127.0.0.1 port 1433 (TDS version 7.1)
net.c:270:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:306:getsockopt(2) reported: Connection refused
net.c:316:tds_open_socket() failed
util.c:331:tdserror(0x7fb50bc04150, 0x7fb50bc04250, 20009, 61)
util.c:361:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:384:tdserror: returning TDS_INT_CANCEL(2)
mem.c:615:tds_free_all_results()
Any help would be greatly appreciated!
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
-
[freetds] MAMP, FreeTDS, ODBC, and ssh tunnel port forwarding almost working...,
Andrew Rousseau, 09/14/2014
- Re: [freetds] MAMP, FreeTDS, ODBC, and ssh tunnel port forwarding almost working..., Randy Syring, 09/15/2014
Archive powered by MHonArc 2.6.24.