I am trying to connect to my company's SQL Server Databases via my MacBook and have followed the steps outlined here: https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-Mac-OSX but keep getting the following error when I get to the following step:
Check that all is OK by running isql TEST myuser mypassword. You should see the following:
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
I already verified that the following works:
Test the connection using the tsql utility, e.g. tsql -S TEST -U myuser -P mypassword. If this works, you should see the following:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1>
The odbcinst.ini and odbc.ini configuration files are both in the same directory.
MacBook-Pro: myname$ odbcinst -j
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /Users/myname/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
odbcinst.ini file config:
[FreeTDS]
Description=FreeTDS Driver for Linux & MSSQL
Driver=/usr/local/lib/libtdsodbc.so
Setup=/usr/local/lib/libtdsodbc.so
UsageCount=1
odbc.ini config:
[TEST]
Description = Test to SQLServer
Driver = FreeTDS
Servername = ServerName
freetdf.conf
# $Id: freetds.conf,v 1.12 2007-12-25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".
# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
tds version = auto
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
# If you experience TLS handshake errors and are using openssl,
# try adjusting the cipher list (don't surround in double or single quotes)
# openssl ciphers = HIGH:!SSLv2:!aNULL:-DH
# A typical Sybase server
[egServer50]
host = symachine.domain.com
port = 5000
tds version = 5.0
# A typical Microsoft server
[TEST]
host = ServerName
port = 1433
tds version = 7.3
client charset = UTF-8
My command and the output:
isql TEST myuser mypass -v
[IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified
[ISQL]ERROR: Could not SQLConnect
tsql -S MYMSSQL ...works for you? If so, then you're not giving us the whole story because nowhere in any of your configuration files is there an entry namedMYMSSQL. Please edit your question to describe exactly (and concisely) what you are really doing, what works, and what doesn't. - Gord Thompsontds version = 8.0isn't invalid. This won't prevent the connection, but you should choose a propertds version, depending on your version of FreeTDS. See the second table on this page: freetds.org/userguide/choosingtdsprotocol.htm - FlipperPA