Connecting to MS SQL Server from MAC application with FreeTDS fails - sql-server

I'm trying to connect to Microsoft SQL Server from my Mac application using iODBC and FreeTDS. No matter what I do, I get the error message Unable to connect to data source from the FreeTDS driver. i have consulted as many possible manuals, blog posts, and StackOverflow questions.
Following is the troubleshooting steps i tried and more details about my code,
DB Connection string = Driver=/Applications/xxx.app/Contents/Frameworks/libtdsodbc.so;Server=ip;DATABASE=DB;TDS_Version=8.0;Port=1433;ClientCharset=UTF-8;uid=username;pwd=*****;Trusted_Connection=No;
From application logs,
SQLGetDiagRec function returns
[01000] [FreeTDS][SQL Server]Adaptive Server connection failed (20002)
[08001] [FreeTDS][SQL Server]Unable to connect to data source (0)
Few StackOverflow post's suggested this is due to TDS version and changing to 8.0 would help but its already set.
When I ping the server - no packets are lost.
Connection is established when i telnet the server on 1433 port.
Using the below i am able to establish connection too,
tsql -H >IP< -p 1433 -U username -P password
In this particular post as per the comments by Max Bolingbroke
if SERVER attribute is used then freetds.config and odbc.ini are ignored. So i guess the config file parameters dont help much.
Could anyone please provide me with some pointers or any help so i can proceed further.

Related

Microstrategy 10.4 SQL ODBC Connection error

I've tried to connect an SQL database from a server with Microstrategy located in another server through an ODBC connector for SQL.
First I've checked that there is a connection between the two servers executing a ping sentence with the IP Address the other server and it went through.
After making sure the connection is stablished without issues, I've tried to connect through Microstrategy without success. The error I get is the following message:
"Connection test error: Connect failed. Error type Odbc error. Odbc operation attempted: SQLDriverConnect (08001:0: on SQLHANDLE)"
Using SQL Server 2017 for the databases and Microstrategy 10.4.
Please, anybody has any clue about what might be happening?
Thanks,
look at the type of connector to the db you have. It gave me the same error until I used: "with Native Client Driver".
Could you please share the complete error message, SQL Handle error are associated with multiple error scenarios like invalid username * password, connecting 64 bit server with 32 bit ODBC driver etc. Complete error message would help me to debug it.
In general follow the steps to debug the error, (any order)
Check the version of ODBC Connection (64bit / 32 bit), it should be the same as server version.
Try testing the ODBC connection that you have created using ODBC Administrator tools to see whether there is an problem with username & password/server name or database connection issue.
Check the Database Instance/Database Connection/User Login created under the Administration option to ensure everything is working and give the correct value.
if nothing works try using the native driver given by MicroStrategy, you can access this using Connectivity Wizard.
Hope it helps..

Use the TDS Remoting feature of the CData ODBC Driver for mongodb to set up a linked server for MongoDB data

I installed the CData ODBC Driver for MongoDB to make the application that can access SQL Server connect to mongodb.
According to the official document,I have configured the system DSN.
Then I modified the config file 'CData.ODBC.MongoDB.Remoting.ini' config file screenshot:-
,in which the users and passwords was the same as what I typed in DSN.
I started CData.ODBC.MongoDB.Remoting.exe and the console printed
Test connection successful. CData ODBC Driver For MongoDB 2015
remoting server starts.Local port :3309.
But when I created a linked server from SQL Server Management Studio linked server info
,it showed that the user 'noobwulei' login failed.
I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
Based on the console output, looks like the remoting service isn't running on the expected port:
... Local port :3309.
According to the Help documentation (http://cdn.cdata.com/help/DGB/odbc/pg_cli.htm) the executable runs the MySQL daemon by default.
In order to run the TDS daemon, you will need to run the executable from the command line and pass TDS as the protocol option (-t):
\> CData.ODBC.MongoDB.Remoting.exe -t TDS

Cannot Connect to SQL Named Instance using TCP/IP and 127.0.0.1 Loopback IP Address

Evening all,
We have been tasked to connect to our named server instance using SQLCMD below:
- Use SQLCMD to test connecting to the (named instance) TCP/IP listener
on TCP port 1433. Use the 127.0.0.1 loopback address to simulate the
network.
I have tried just about every method of connecting I can think of including the following basic scripts:
sqlcmd -S tcp:MyComputerName,1433
sqlcmd -S tcp:127.0.0.1,1433
sqlcmd.exe -S tcp:MyComputerName,1433 -Q "select getdate()"
This is the error I continually get:
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login timeout expired.
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0: A network-related or instance-specific error has occured while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections.
I went through all the troubleshooting methods to ensure my Firewall accepts port 1433. I ensured Remote Connections could be accepted using the SQL Server Management Tool. TCP/IP protocol is enabled under all three areas of the Network Configuration Tool. The ports are 1433 in each protocol.
I am utterly confused.
I will say that there is one script I do get a positive connection via tcp and that is the following:
sqlcmd -S tcp:MyComputerName\SQLSERVERNAME
I end up with 1> to let me know the connection was good.
After researching this for quite some time I have turned to posting as I have been unable to troubleshoot a solution.
Thoughts?
edit
Just got this error for the first time:
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0: TCP Provider: No connection could be made because the target machine actively refused it.
I just ran into this problem too, right after a bran new installation of SQL-Server 2008r2 Developer on a Windows 10.
As Tim3890 pointed out, The issue was just that TCP/IP was not enable for the local SQL server.
see: https://dba.stackexchange.com/questions/62165/i-cant-connect-to-my-servers-sql-database-via-an-ip-address

MySQL Unable to connect to remote host

I am just wasting too much time with this issue. My final goal is to change the collation of the Amazon RDS DB from latin to utf8. To accomplish that, there is a lot of information out there, and yet, non of that has worked for me.
First of all I tried to prompt mysql:
mysql -h ###.###.us-west-1.rds.amazonaws.com -p --port=3306
but it raise an ERROR 2003 (HY000): Can't connect to MySQL server on '###.###.us-west-1.rds.amazonaws.com' (60)
If I try using telnet:
telnet ###.###.us-west-1.rds.amazonaws.com 3306
Trying 54.###.##.##...
telnet: connect to address 54.###.##.##: Operation timed out
telnet: Unable to connect to remote host
Looking at the aws.docs says that I have to authorize access to my cache cluster. But I could't get that far. I didn't know what to put on the Port rangeand Source by trying to add a new Custom TCP rule for my default security group. So I ended following this tutorial using mysqldump but I have the same connection problem as using >mysql
Any help would be really appreciated!

Connecting to SQL server, getting error 2013 (HY000) Lost connection

I am on Linux, trying to connect to SQL server.
Using sqlplus, as below:
sqlplus username/password#server:port;
Getting ORA-12537 error - "TNS: Connection closed". This error comes after a long wait.
While trying to figure out what the issue was, I got -
"TNSPING server:port" returned error : TNS-12537 TNS Connection closed.
"TELNET server port" is working fine. It shows connected status.
Also tried using Easy connect after reading another post LINK. This is the command I tried "sqlplus username/password#//server/port". It gave me error ORA-12541 : TNS: No listener.
Just want to add that I am able to connect to an Oracle db using sqlplus, with no problem.
Version is 10.2.0.4.
Any idea how to fix this? Appreciate the help!
UPDATE: I did not know sqlplus can't connect to SQL server. I tried connecting using mysql, but got an error:
MYSQL -h server -P port -u username -ppassword
returned error : ERROR 2013 (HY000): Lost connection to mysql server at 'reading initial communication packet', system error 104. This error also comes after a long wait.
Thanks for your help!
You will need an SQL Server specific client to connect to SQL Server, sqlplus is a oracle client and mysql is a command line client for the mysql server. Microsoft provides a JDBC driver at http://msdn2.microsoft.com/en-us/data/aa937724.aspx or a Linux ODBC driver at http://www.microsoft.com/download/en/details.aspx?id=28160. This might help if you have some kind of software that can use those drivers, e.g. RazorSQL (http://razorsql.com/features/sqlserver_features.html)

Resources