How to fix the [unixODBC][Driver Manager]Data source name not found, and no default driver specified (ODBC::Error)

前端 未结 4 1064
没有蜡笔的小新
没有蜡笔的小新 2020-12-17 23:33
/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-sqlserver-adapter-3.2.12/lib/active_record/connection_adapters/sqlserver_adapter.rb:455:in `initialize\': IM002 (0)         


        
4条回答
  •  悲&欢浪女
    2020-12-18 00:10

    You should start by setting up and configuring FreeTDS. Here is a sample configurations from my files, but I'm sure other variants will work also. One difference is that I'm using Django, but the result below still worked eventually, but it works much better with SQL authentication than with Windows Authentication.

    From /etc/freetds/freetds.conf (use the IP of the server if DNS is not active for the server name).

    # A typical Microsoft server
    [MyServer]
            host = 10.0.0.10\path
            port = 1433
            tds version = 7.0
    

    From /etc/odbcinst.ini

    [FreeTDS]
    Description = FreeTDS
    Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
    

    From /etc/odbc.ini

    [ServerDSN]
    Description = "Some Description"
    Driver = FreeTDS
    ServerName = MyServer
    Server = ip_address
    Port = 1433
    Database = DBNAME
    

    Then this command connects me to the database.

    tsql -S MyServer -U username@servername -P password

提交回复
热议问题