SIMEL
SIMEL

Reputation: 8941

Accessing Microsoft SQL Server from Tcl running on GNU/Linux

I'm looking for a source to explain how to use connection-strings, as a client from Linux. I am working with tcl in Linux environment and get a connection-string that supposed to connect me to a Microsoft SQL server.

Do you know of a good source that shoes how to connect to a server with a connection string, and how to connect from Linux?

All the sources I found online talk about creating server strings, and don't address Linux usage at all.

Upvotes: 1

Views: 1028

Answers (1)

kostix
kostix

Reputation: 55483

Your question per se has no sense: "connection strings" is the concept which is not inherent to programming languages or database servers. Connection strings pertain to database connection libraries and usually they even differ between different database drivers used by those libraries.

Now back to the point. Personally, I'm using tclodbc with the FreeTDS driver. How to build connection strings for the FreeTDS ODBC driver, is explained here.

I do not use connection strings directly; instead I use "ODBC sources" which are configured system-wide, in the /etc/odbc.ini file (managed by the unixodbc as packaged in Debian). Basically, that file contains entries like this:

[SERVER1]
Description = MS SQL Server on server1.domain.local
Driver      = /usr/lib/odbc/libtdsodbc.so
Servername  = SERVER1

and the /etc/freetds/freetds.conf file contains matching entries like this:

[SERVER1]
    host = server1.domain.local
    port = 1433
    tds version = 7.0
    client charset = UTF-8

Now, in my Tcl code I have something like this:

set source SERVER1
database connect dbconn $source $user $password
...

Upvotes: 4

Related Questions