LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-26-2015, 02:33 AM   #1
NAMACHEVAYAM
LQ Newbie
 
Registered: Jun 2015
Posts: 3

Rep: Reputation: Disabled
hi i want to connect mssql from my linux system .


hi guys i using redhat linux 6 system which has folling configuration settings

odbcinst -j
unixODBC 2.3.0
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

odbcinst -q -d -n "SQL Server Native Client 11.0"
[SQL Server Native Client 11.0]
Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
Threading=1
UsageCount=1


in odbc.ini file contains
[MSSQLTest]
Driver=SQL Server Native Client 11.0
Description=My Sample ODBC Database Connection
Trace=Yes
Server=192.***.***.***
Port=1443
Database={name of database}

in odbcinst.ini file contains
[SQL Server Native Client 11.0]
Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
Threading=1
UsageCount=1




but when i connect to sql means th below problem arrives

[root@Freedom Desktop]# isql

**********************************************
* unixODBC - isql *
**********************************************
* Syntax *
* *
* isql DSN [UID [PWD]] [options] *
* *
* Options *
* *
* -b batch.(no prompting etc) *
* -dx delimit columns with x *
* -x0xXX delimit columns with XX, where *
* x is in hex, ie 0x09 is tab *
* -w wrap results in an HTML table *
* -c column names on first row. *
* (only used when -d) *
* -mn limit column display width to n *
* -v verbose. *
* -lx set locale to x *
* -q wrap char fields in dquotes *
* -3 Use ODBC 3 calls *
* -n Use new line processing *
* -e Use SQLExecDirect not Prepare *
* --version version *
* *
* Commands *
* *
* help - list tables *
* help table - list columns in table *
* help help - list all help options *
* *
* Examples *
* *
* isql WebDB MyID MyPWD -w < My.sql *
* *
* Each line in My.sql must contain *
* exactly 1 SQL command except for the *
* last line which must be blank (unless *
* -n option specified). *
* *
* Please visit; *
* *
* http://www.unixodbc.org *
* pharvey@codebydesign.com *
* nick@easysoft.com *
**********************************************

[root@Freedom Desktop]# isql -v MSSQLTest username pwd
[S1T00][unixODBC][Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired
[08001][unixODBC][Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred 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. For more information see SQL Server Books Online.
[08001][unixODBC][Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: Error code 0x2AF9
[ISQL]ERROR: Could not SQLConnect
[root@Freedom Desktop]#






pls guys hep me to solve this problem pls pls,, i really needs urgently the solution
 
Old 06-26-2015, 09:32 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,580
Blog Entries: 14

Rep: Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969
Your error mentions "mysql". That is NOT the same thing as "mssql". MySQL is an opensource datatabase. MSSQL is a proprietary database on MS Windows (originally derived from Sybase).

I haven't tried to connect to MSSQL on Windows from Linux but doing a search yields several hits the first of which looks like it might be useful:
http://richbs.org/post/43142767072/c...rver-from-unix

That suggests use of FreeTDS for talking to MSSQL. The link they have in the above post for FreeTDS isn't working but I found their main site is still active:
http://www.freetds.org/

Be careful in your searches - the next link after the one I mention above was talking about unixODBC but clearly for mysql rather than mssql.

Last edited by MensaWater; 06-26-2015 at 09:57 AM.
 
Old 06-26-2015, 10:30 AM   #3
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,179
Blog Entries: 10

Rep: Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980
Here is a sample from a working host:
Code:
cat /usr/local/etc/odbcinst.ini 
[SQL Server Native Client 11.0]
Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
Threading=1
UsageCount=2

[FreeTDS]
Description=TDS driver (Sybase/MS SQL)
Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
UsageCount=1

cat /usr/local/etc/odbc.ini
[oscardsn]
Driver = FreeTDS 
Description = MSSQL database for my nice app
# Servername corresponds to the section in freetds.conf
Servername=DressingRoom_Server
Database = DressingRoom
and we connect using
Code:
isql -v <dsn> <user> <pass>
and worked that out from the same link MensaWater provided.

Last edited by Habitual; 06-26-2015 at 10:33 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
MSSQL on Linux? spider99 Linux - Server 5 05-18-2010 10:23 AM
Program type out of range erro when trying to connect QT with MSSQL urup Linux - Software 1 01-30-2010 02:31 PM
PHP connect to MSSQL question leiw Programming 2 09-28-2008 10:34 AM
How to connect to mssql using c program raiux Programming 1 04-10-2008 05:21 AM
How can i connect mssql server from linux apache sachitanandpandey Linux - Software 1 10-25-2006 07:04 PM


All times are GMT -5. The time now is 12:47 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration