2013-08-14 17 views
17

Próbuję uruchomić połączenie z serwerem MSSQL z serwera Ubuntu 12.04 za pomocą FreeTDS i unixODBC.FreeTDS działa, ale ODBC nie może połączyć się z

Korzystanie tsql mogę połączyć się z serwerem z

~$ tsql -S dbs3 -U <username> -P <password> 

nie ma problemu.

Gdy próbuję się połączyć z isql jednak, pojawia się następujący komunikat o błędzie:

~$ isql -v database3 <username> <password> 
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source 
[01000][unixODBC][FreeTDS][SQL Server]Unknown host machine name. 
[ISQL]ERROR: Could not SQLConnect 

Moje pliki konfiguracyjne są następujące:

ODBC.INI

[database3] 
Driver=FreeTDS 
TDS_Version=8.0 
Servername=dbs3 
Port=1433 
Database=benchmark_res 

odbcinst. ini

[FreeTDS] 
Description=FreeTDS v0.91 
Driver=/usr/local/lib/libtdsodbc.so 
Setup=/usr/local/lib/libtdsS.so 
Trace=Yes 
TraceFile=/tmp/freetds.log 
ForceTrave=Yes 
UsageCount=1 

freetds.conf

# 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 = 4.2 

    # 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 

# A typical Sybase server 
[egServer50] 
    host = symachine.domain.com 
    port = 5000 
    tds version = 5.0 

# A typical Microsoft server 
[egServer70] 
    host = ntmachine.domain.com 
    port = 1433 
    tds version = 7.0 

[dbs3] 
    host = <server-ip> 
    port = 1433 
    tds version = 8.0 

I przestrzegać instrukcji instalacji 1. here i 2. here

Dlaczego nie ISQL łączący prawidłowo?
Domyślam się, że błędem jest bardzo oczywiste, ale jestem zbyt głupi, żeby go zobaczyć: D

Odpowiedz

1

Jeśli ODBC nie znajdzie źródła danych to oznacza, że ​​jesteś dostarczając niewłaściwy

Prawdopodobnie stara aby połączyć się dbs3 który nie powiedzie, jeśli nie ma go w ODBC.INI

należy podłączyć do [database3] ODBC

isql -v database3 <username> <password> 
+0

To, co robię. Używam dbs3 z tsql: tsql-S dbs3 -U -P . Używanie isql sposób, w jaki wspomniałeś, zwraca te błędy – AndMim

+0

Ok, czy dodałeś bazę danych3 do twojego pliku hosta – meda

+0

Nie, ponieważ z mojego zrozumienia, powinien on zostać rozwiązany z adresem IP, który wpisałem w freetds.conf – AndMim

11

kwestia ta linia była w ODBC.INI

[database3] must be [dbs3] in your case. 

dla tych, które mają również ten problem, sprawdź również

ServerName = *Points to the name of the server configured in freetds.conf* 
Powiązane problemy