LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-02-2016, 02:05 PM   #1
Sharkadder
LQ Newbie
 
Registered: Dec 2012
Posts: 17

Rep: Reputation: Disabled
ODBC drivers and connecting to mssql on linux not connecting to data source


Hi there,

I currently run a linux based web server which has ubuntu on it. After some doing i have now managed to get the odbc drivers working on my ubuntu operating system. However everytime i try and connect to this to mssql i get the following error message:

[unixODBC][FreeTDS][SQL Server]Unable to connect to data source

Does this mean that the port needs to be forwarded or that the username and password i have is incorrect? I assume this means that the driver is ok? When i try a tsql command it just seems to time out after 60 seconds

tsql -H ***.***.***.*** -p 1433 -U A******* -P *******

When i do a telnet on the IP address it comes back as connected, likewise when i do it for a port which i know is open. Rhe second i add in port 1433 which is the MSSQL port into the telnet i get a timeout. Does anybody know how i could debug this further i.e. trace the path to see if it is a username or password fault or indeed a lack of port forwarding issue?

I don't have access to the mssql server remotely until next week, otherwise i would have checked the username or password?

I can post odbc.ini and odbcinst.ini and FreeTDS configs as required

Many thanks,

Mark

Last edited by Sharkadder; 01-02-2016 at 02:07 PM.
 
Old 01-02-2016, 03:13 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by Sharkadder View Post
Hi there,
I currently run a linux based web server which has ubuntu on it. After some doing i have now managed to get the odbc drivers working on my ubuntu operating system. However everytime i try and connect to this to mssql i get the following error message:

[unixODBC][FreeTDS][SQL Server]Unable to connect to data source

Does this mean that the port needs to be forwarded or that the username and password i have is incorrect? I assume this means that the driver is ok? When i try a tsql command it just seems to time out after 60 seconds

tsql -H ***.***.***.*** -p 1433 -U A******* -P *******

When i do a telnet on the IP address it comes back as connected, likewise when i do it for a port which i know is open. Rhe second i add in port 1433 which is the MSSQL port into the telnet i get a timeout. Does anybody know how i could debug this further i.e. trace the path to see if it is a username or password fault or indeed a lack of port forwarding issue?

I don't have access to the mssql server remotely until next week, otherwise i would have checked the username or password?
I can post odbc.ini and odbcinst.ini and FreeTDS configs as required
I'd start with the obvious things first...such as are you *POSITIVE* that remote database is up? Since you can telnet to the server itself, but NOT the MSSQL port...that may be the cause. From there, check your firewall rules...that port may be blocked somewhere. After that, user ID/password.

Barring any of that, you just mention that you are using Ubuntu, and say you're using MSSQL with a 'web server'...assuming you're using Apache (and not something else), what is the MSSQL role in this puzzle? If you're using PHP, you can access the database directly, without installing those drivers:
http://php.net/manual/en/function.mssql-connect.php
 
Old 01-04-2016, 03:39 AM   #3
Sharkadder
LQ Newbie
 
Registered: Dec 2012
Posts: 17

Original Poster
Rep: Reputation: Disabled
Hi there and thank you for the reply. I have tried using the mssql_connect command with both the domain name and IP address and it says that it could not connect to the server. The remote database is definitely up as i have checked on the windows server this morning.

I have checked my freeTDS config and in it i have host, port and have set it to version 8.0:


# A typical Sybase server
[mssql]
host = **.**.**.***
port = 1433
tds version = 8.0

I think it may be a port forwarding issue as data being sent to it from another source is not currently being received either. I do use Apache and it is being used for a PHP application.
 
Old 01-04-2016, 08:20 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by Sharkadder View Post
Hi there and thank you for the reply. I have tried using the mssql_connect command with both the domain name and IP address and it says that it could not connect to the server. The remote database is definitely up as i have checked on the windows server this morning.

I have checked my freeTDS config and in it i have host, port and have set it to version 8.0:


# A typical Sybase server
[mssql]
host = **.**.**.***
port = 1433
tds version = 8.0

I think it may be a port forwarding issue as data being sent to it from another source is not currently being received either. I do use Apache and it is being used for a PHP application.
I'd definitely check out the PHP option posted, then. FAR easier, and it uses the existing PHP framework, and is quite easy to test. But, a port-forwarding issue wouldn't be uncommon in this scenario, as far as a basic connectivity issue goes. For the coding, PHP sidesteps a good bit of that complexity.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
odbc not connecting to Mysql packets Linux - Software 1 04-08-2013 01:39 AM
Connecting Linux Mysql from Windows XP ODBC mfdarvesh Linux - Server 4 05-24-2010 08:30 AM
MSSQL/ODBC connection, query hangs grgl Linux - Software 0 03-06-2009 01:02 PM
Connecting to MySql using ODBC RickyO Ubuntu 4 01-30-2008 04:21 PM
Connecting to MSSQL Server 7 from Linux vil Linux - Software 3 07-07-2004 12:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration