xoxomos
asked on
Freetds Connection
C:\freetds-0.95rc2\bin>tsq l -C
Compile-time settings (established with the "configure" script)
Version: freetds v0.95rc2
freetds.conf directory: \freetds-0.95rc2\etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.0
iODBC: no
unixodbc: yes (unixODBC 2.3.2)
SSPI "trusted" logins: yes
Kerberos: yes (Heimdal 1.6.99)
OpenSSL: yes (OpenSSL 1.0.2a)
GnuTLS: no
C:\freetds-0.95rc2\bin>tsq l -H localhost -p 1433 -U sa -P master -D tempdb
locale is "English_United States.1252"
using default charset "UTF-8"
Setting tempdb as default database in login packet
.
.
.
This just seems to hang. How do i get a prompt to allow me to run a query?
Compile-time settings (established with the "configure" script)
Version: freetds v0.95rc2
freetds.conf directory: \freetds-0.95rc2\etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.0
iODBC: no
unixodbc: yes (unixODBC 2.3.2)
SSPI "trusted" logins: yes
Kerberos: yes (Heimdal 1.6.99)
OpenSSL: yes (OpenSSL 1.0.2a)
GnuTLS: no
C:\freetds-0.95rc2\bin>tsq
locale is "English_United States.1252"
using default charset "UTF-8"
Setting tempdb as default database in login packet
.
.
.
This just seems to hang. How do i get a prompt to allow me to run a query?
ASKER
I'm sure you're correct about not needing freetds to run queries. My situation is i'm trying unsuccessfully to connect from a python program to SQLServer. Some of the posts i've read leads me to believe i need a specific version of freetds to work on a python3/sqlserver connection.
ASKER
C:\freetds-0.95rc2>cd bin
C:\freetds-0.95rc2\bin>tsq l -S 134.154.228.217 -U sa -P master
locale is "English_United States.1252"
using default charset "UTF-8"
......still waiting.... :-(
C:\freetds-0.95rc2\bin>tsq
locale is "English_United States.1252"
using default charset "UTF-8"
......still waiting.... :-(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. Yes, i get prompt for password using either localhost, the machine ip or SQLExpress.
C:\freetds-0.95rc2>cd bin
C:\freetds-0.95rc2\bin>tsq l -H localhost -p 1433 -U sa
Password: master
locale is "English_United States.1252"
using default charset "UTF-8"
^C
C:\freetds-0.95rc2\bin>tsq l -H 134.154.228.217 -p 1433 -U sa
Password: thebes
locale is "English_United States.1252"
using default charset "UTF-8"
^C
C:\freetds-0.95rc2\bin>
C:\freetds-0.95rc2\bin>tsq l -H MSSQLServer -p 1433 -U sa
Password: thebes
Error 20012 (severity 2):
Server name not found in configuration files.
locale is "English_United States.1252"
using default charset "UTF-8"
Error 20013 (severity 2):
Unknown host machine name.
There was a problem connecting to the server
C:\freetds-0.95rc2\bin>tsq l -H SQLExpress -p 1433 -U sa
Password: thebes
locale is "English_United States.1252"
using default charset "UTF-8"
C:\freetds-0.95rc2>cd bin
C:\freetds-0.95rc2\bin>tsq
Password: master
locale is "English_United States.1252"
using default charset "UTF-8"
^C
C:\freetds-0.95rc2\bin>tsq
Password: thebes
locale is "English_United States.1252"
using default charset "UTF-8"
^C
C:\freetds-0.95rc2\bin>
C:\freetds-0.95rc2\bin>tsq
Password: thebes
Error 20012 (severity 2):
Server name not found in configuration files.
locale is "English_United States.1252"
using default charset "UTF-8"
Error 20013 (severity 2):
Unknown host machine name.
There was a problem connecting to the server
C:\freetds-0.95rc2\bin>tsq
Password: thebes
locale is "English_United States.1252"
using default charset "UTF-8"
you need to find the freetds.conf on that computer and need to put the apropriate values - see link below - in order to clear issues like "...Server name not found in configuration files."
http://pymssql.org/en/latest/freetds.html
http://pymssql.org/en/latest/freetds.html
ASKER
From my .conf file.
# A typical Microsoft server
[SQLExpress]
host = 134.154.228.217
port = 1433
# use ntlmv2 = yes
encryption = request
tds version = 8.0
Sorry, been away from this a while and thanks, I'm taking a second look at the link noticing
".....The system-wide FreeTDS configuration file is /etc/freetds.conf'. I have my .conf file in c:\freetds\etc on windows and just now waking up to /etc is not the same as \etc .:-(
# A typical Microsoft server
[SQLExpress]
host = 134.154.228.217
port = 1433
# use ntlmv2 = yes
encryption = request
tds version = 8.0
Sorry, been away from this a while and thanks, I'm taking a second look at the link noticing
".....The system-wide FreeTDS configuration file is /etc/freetds.conf'. I have my .conf file in c:\freetds\etc on windows and just now waking up to /etc is not the same as \etc .:-(
ASKER
Tried copying .conf file directly onto c:\ with the same results. Using SQLExpress, localhost, ipaddress, it finds something and hangs after accepting password. Using another name, SQLServer, it knows there is no such instance period.
C:\freetds-0.95rc2\bin>tsq l -H SQLExpress -p 1433 -U sa
Password: hebes
locale is "English_United States.1252"
using default charset "UTF-8"
^C
C:\freetds-0.95rc2\bin>^V
'▬' is not recognized as an internal or external command,
operable program or batch file.
C:\freetds-0.95rc2\bin>tsq l -H MSSQLServer -p 1433 -U sa
Password:hebes
Error 20012 (severity 2):
Server name not found in configuration files.
locale is "English_United States.1252"
using default charset "UTF-8"
Error 20013 (severity 2):
Unknown host machine name.
There was a problem connecting to the server
C:\freetds-0.95rc2\bin>tsq l -H localhost -p 1433 -U sa
Password: hebes
locale is "English_United States.1252"
using default charset "UTF-8"
Will try changing the version 8 to version 7.
C:\freetds-0.95rc2\bin>tsq
Password: hebes
locale is "English_United States.1252"
using default charset "UTF-8"
^C
C:\freetds-0.95rc2\bin>^V
'▬' is not recognized as an internal or external command,
operable program or batch file.
C:\freetds-0.95rc2\bin>tsq
Password:hebes
Error 20012 (severity 2):
Server name not found in configuration files.
locale is "English_United States.1252"
using default charset "UTF-8"
Error 20013 (severity 2):
Unknown host machine name.
There was a problem connecting to the server
C:\freetds-0.95rc2\bin>tsq
Password: hebes
locale is "English_United States.1252"
using default charset "UTF-8"
Will try changing the version 8 to version 7.
ASKER
Nope, do't think i should do that actually.
ASKER
What should i be looking for once I enter the requested password?
ASKER
One thing i'm noticing is when i run tsql -C the version comes out as 7 whereas the .conf file i have version set to 8. Could this be part of the problem?
:\freetds-0.95rc2\bin>tsql -C
ompile-time settings (established with the "configure" script)
Version: freetds v0.95rc2
freetds.conf directory: \freetds-0.95rc2\etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.0
iODBC: no
unixodbc: yes (unixODBC 2.3.2)
SSPI "trusted" logins: yes
Kerberos: yes (Heimdal 1.6.99)
OpenSSL: yes (OpenSSL 1.0.2a)
GnuTLS: no
# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
tds version = 8.0
client charset = UTF-8
dump file = C:\freetds-0.95rc2\etc\fre eTDS.log
text size = 64512
# A typical Microsoft server
[SQLExpress]
host = 134.154.228.217
port = 1433
# use ntlmv2 = yes
encryption = request
tds version = 8.0
:\freetds-0.95rc2\bin>tsql
ompile-time settings (established with the "configure" script)
Version: freetds v0.95rc2
freetds.conf directory: \freetds-0.95rc2\etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.0
iODBC: no
unixodbc: yes (unixODBC 2.3.2)
SSPI "trusted" logins: yes
Kerberos: yes (Heimdal 1.6.99)
OpenSSL: yes (OpenSSL 1.0.2a)
GnuTLS: no
# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
tds version = 8.0
client charset = UTF-8
dump file = C:\freetds-0.95rc2\etc\fre
text size = 64512
# A typical Microsoft server
[SQLExpress]
host = 134.154.228.217
port = 1433
# use ntlmv2 = yes
encryption = request
tds version = 8.0
ASKER
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import _mssql
>>> conn = _mssql.connect(server='war ehouse', user='sa', password='master!!', database='master')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_mssql.pyx", line 1887, in _mssql.connect (_mssql.c:19107)
File "_mssql.pyx", line 632, in _mssql.MSSQLConnection.__i nit__ (_mssql.c:5880)
_mssql.MSSQLDriverExceptio n: Connection to the database failed for an unknown reason.
>>>
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import _mssql
>>> conn = _mssql.connect(server='war
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_mssql.pyx", line 1887, in _mssql.connect (_mssql.c:19107)
File "_mssql.pyx", line 632, in _mssql.MSSQLConnection.__i
_mssql.MSSQLDriverExceptio
>>>
ASKER
Looks like i will have to go with adding either unixODBC or IODBC into the mix with freetds.
Yes, my objective is to eventually run on OSX to SQLServer.
I believe the -H flag is for HOST and is ok.
Yes, my objective is to eventually run on OSX to SQLServer.
I believe the -H flag is for HOST and is ok.
ASKER
Problem was 1433 was not the port sqlserver was running on.
tsql -S servername -U sa -P master
try that and leave the tempdb defualt outr for now. If servername is not recognized try the IP of your SQL Server and leave the port out unless your SQL is not running on default port 1433.
But...Do you really need to use freetds to run the queries? are you running them from a non Windows system against that SQL Server? If not, you should be able to use SQL own sqlcmd instead (or SSMS) like:
sqlcmd -U MyLogin -S <ComputerName>\<InstanceNa
http://www.sqlbook.com/SQL-Server/SQLCMD-command-line-utility-13.aspx
https://msdn.microsoft.com/en-CA/library/ms180944.aspx