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

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)

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..

Firebird ODBC Setup Error

I have a Firebird Database (v2.5) which lives on a server with hostname "FBDEVDB". I am working on a separate server on which I have installed SQL Server to begin the process of migrating the tables and data into a SQL Server database.
I saw several posts discussing that this can be done using the Import Data feature of SSMS with an ODBC connection to the Firebird DB. So, I have downloaded and installed the Firebird ODBC Driver 64-Bit. When I went to configure my DSN I first got an error regarding a missing gds32.dll. Looking into it further, I realized I needed the fbclient.dll from the Firebird files. I've copied it over to my SQL Server machine, and now the gds32.dll error is gone, and I can tell it is TRYING to connect to the Firebird instance because if I provide an incorrect username/password it tells me my login is incorrect.
However, when I use a valid login/password, I get the following error message
I have defined the following fields in the ODBC setup
Database: FBDEVDB::C:\Firebird\MYDATABASE.FDB
Client: C:\Temp\fbclient.dll
Database Account: SYSDBA with VALID PASSWORD
What am I missing? I can not seem to find any information on what this error means.
Thank you!!!!!

ODBC SQL Server Driver Login timeout expired

I'm failing to connect to a SQL server SQLExpress. The connection worked fine a few days ago.
This is how I tried to connect (I'm using Microsoft SQL server management studio):
connection = pyodbc.connect("DSN=sqlServer; UID=myuser;PWD=mypassword")
cursor = connection.cursor()
The error I get:
('HYT00', '[HYT00] [Microsoft][ODBC SQL Server Driver]Login timeout expired (0) (SQLDriverConnect)')
In the ODBC Data Source Administrator, when I test the data source I get:
I got the similar issue.
The problem was actually I was using "SQL Server" as the driver in my ODBC settings in my DSN.
The driver should be "SQL Server Native Client 11.0".
It fixed the issue for me.
Because you are having the same issue in the ODBC Data Source Administrator I would try to focus on that first not on your code.
Here you can find a list with possible problems
Maybe this can help you find out what the problem is.
I also would try to connect with the SQL Server Management Studio.
Maybe it is possible to connect with a different user or via Windows login.
That would mean that your user might not exist anymore (maybe because you renewed tha database or something).
Also I sometimes have the problem that the SQL Server is not started either locally or on the server.
Maybe you could check if the service is started and the database is running.

Connecting to MS SQL Server from MAC application with FreeTDS fails

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.

Pentaho connection issue

I installed MS SQL Server 2008 R2 on my laptop, just to practice SQL and it is running on localhost. I also downloaded Pentaho to learn a BI tools. The problem is I have been getting the below error for a week or so and cannot seem to find a solution.
Error connecting to database [test] : org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
Error connecting to database: (using class net.sourceforge.jtds.jdbc.Driver)
Network error IOException: Connection refused: connect
org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
Error connecting to database: (using class net.sourceforge.jtds.jdbc.Driver)
Network error IOException: Connection refused: connect
I have tried every possible login combination and also installed the necessary Java drives.
Any help is much appreciated.
At the first, you check sql server is listening on default port, sometimes isnĀ“t take default port(antivirus,firewal, anyway).
Check the PID of SQL server service
type "netstat -a -n -o" command on console
search your PID on it and get your port where your sqlserver is listening

Resources