Saturday, August 20, 2016

SQL Server Connection from Ubuntu 14.04 and SQL Server using FreeTDS

So, everything is installed properly and it is time to test database connection to SQL Server. Here are some of my pointers:


  • Install FreeTDS and PHP with support for Sybase/SQL Server
  • Configure "odbcinst.conf"
[FreeTDS]
Description = FreeTDS Driver v0.91
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
fileusage = 1
dontdlclose = 1
UsageCount = 1
Note: just change to the correct path on the two modules
  • Configure "freetds.conf
[database_server_name]
host = 192.168.101.102
port = 1433
tds version = 4.2
client charset = UTF-8
Note: "database_name" is NOT the instance

  •  Configure "odbc.ini"

[jiradb]
Driver = FreeTDS
Servername = database_name_name
Port = 1433
Database = database_under_instance
TDS_Version = 4.2
Notes:

    • "Driver" field is the name header in "odbcinst.conf"
    • "Servername" field is the database header in "freetds.conf"
    • "Database" field is the target database under the instance
    • TDS_Version - run the command "tsql -C" and you should get the value
To connect:
isql database_server_name -U sa -P password
This is not a complete guide. Be sure to check the links below for further info.





No comments:

Post a Comment