0

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!

Community
  • 1
  • 1
xcentaur
  • 85
  • 1
  • 2
  • 12
  • You can ***NOT*** use SQL*Plus to connect to SQL Server. It's an Oracle only tool. –  Nov 06 '13 at 08:30
  • Oh! Thanks for that. Trying this for the first time. But I'm also not able to connect using **mysql**. Any idea how I can fix this? Thanks for the comment! – xcentaur Nov 06 '13 at 08:36
  • Again: SQL*Plus is an Oracle only tool. It can only **only** connect to an Oracle database (and no, MySQL is not an Oracle database) –  Nov 06 '13 at 08:37
  • Yes, I'm trying to connect to two different dbs. One is Oracle, the other SQL. As you mentioned, I'm not able to connect to SQL db using sqlplus. I get now why that was the case. But I am not able to connect to the SQL db using mysql. Have updated the question to try to make that clearer as well. – xcentaur Nov 06 '13 at 08:41
  • The `mysql` client program can **only** connect to a MySQL database. If you are looking for a more universal tool, you might want to look at this: http://dba.stackexchange.com/questions/19165/scriptable-command-line-access-to-sql-server-from-linux or this post: http://stackoverflow.com/questions/5567867/open-source-sql-client-viewer –  Nov 06 '13 at 08:48
  • Thanks for the links. We can't install anything new, so I'll try another way but will keep these in mind for future. – xcentaur Nov 06 '13 at 09:18
  • I can only speak about one of them: SQL Workben/J - it doesn't need any "installation". You just unzip the archive (it does need a Java runtime though) –  Nov 06 '13 at 09:36

1 Answers1

0

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)

Mithrandir
  • 24,869
  • 6
  • 50
  • 66