简体   繁体   中英

Error 20009 (severity 9): Unable to connect: Adaptive Server is unavailable or does not exist OS error 111, "Connection refused"

I tried to connect to MSSQl database using freetds, unixODBC in raspberry pi 4.Below are my settings.

[fred]
  host = 109.*.*.*    # Remote Sql Server's IP addr
  port = 1433         # this is default
  tds version = 7.4     # this is by the time i post this
  client charset =UTF-8

[test]
Driver = FreeTDS
Description = MSSQL Server
Trace = No
Server = fred      # IP or host name of the Sql Server
Port = 1433           # This is default
TDS_Version = 7.4

[FreeTDS]
Description=FreeTDS Driver
Driver=/usr/lib/arm-linux-gnueabihf/odbc/libtdsodbc.so
Setup=/usr/lib/arm-linux-gnueabihf/odbc/libtdsS.so
UsageCount=1

I have tested with tsql -H ip -U username -P password but the error still persists. I have also installed pyodbc. I am trying to connect from Pi to MS SQl Server Management studio. Could anyone suggest me to have a successful connection to database? I appreciate all the approaches.

I was able to shrug off this error by using the following call:

bsqldb -S $servername:1433 -D $databasename -U $username -P $password -i $inputfile

As far as documentation states, a qualified server name with the port number allows to bypass the related.conf settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM