从在GNU / Linux上运行的Tcl访问Microsoft SQL Server [英] Accessing Microsoft SQL Server from Tcl running on GNU/Linux
问题描述
我正在寻找来源来解释如何作为Linux的客户端使用连接字符串。我正在Linux环境中使用 tcl ,并获得了应该将我连接到Microsoft SQL服务器的连接字符串。
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.
您知道吗一个很好的资料来源,介绍如何使用连接字符串连接到服务器以及如何从Linux连接?
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?
我在网上找到的所有资料都涉及创建服务器字符串,根本不解决Linux的使用问题。
All the sources I found online talk about creating server strings, and don't address Linux usage at all.
推荐答案
您的问题本身毫无意义:连接字符串是编程语言或数据库服务器所不固有的概念。连接字符串与数据库连接库有关,并且通常在这些库使用的不同数据库驱动程序之间也有所不同。
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.
现在回到重点。我个人将 tclodbc 与 FreeTDS 驱动程序。 此处。
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.
我不直接使用连接字符串;相反,我在 /etc/odbc.ini
文件(由 unixodbc $管理)中使用在系统范围内配置的 ODBC源 c $ c>(在Debian中打包)。基本上,该文件包含以下条目:
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
和 /etc/freetds/freetds.conf
文件包含类似的匹配项:
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
现在,在我的Tcl代码中,我有这样的东西:
Now, in my Tcl code I have something like this:
set source SERVER1
database connect dbconn $source $user $password
...
这篇关于从在GNU / Linux上运行的Tcl访问Microsoft SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!