In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you the case of configuring SQLSERVER ODBC under linux. I hope you will get something after reading this article. Let's discuss it together.
A test environment
Operating system Red Hat As 5.5
Database
SQLServer2000 installed in windows xp professional, I assume that the database has a user autotest password is autotest, and the database file is atsdb
Note:
1 MS has never provided SQLServer for Linux, so don't try to install SQLServer on Linux systems, but you can connect through ODBC
SQLServer database of Windows system
2 the SQLServer2000 installed will not open port 1433, so ask Windows xp users to install SQLServer SP3 pudding after installing SQLServer. You can use the command netstat-a to see if port 1433 is open.
3 for windows xp, the default firewall does not allow port 1433 to communicate, so it is necessary to turn off the firewall of windows. This problem has been bothering me all day, and the connection is always unsuccessful. I thought it was the configuration of odbc software. Lesson. The most annoying thing is that isql can access the database on other windows machines using the command isql of sqlserver (without turning off the firewall). Through the bag grabbing tool, it is found that the communication is not through port 1433 at all, but through the internal port of 445or 139. it seems that windowns things are good, but they are too bossy.
4 when installing sqlserver2000 in xp sp2, you must apply the chs_sql2ksp3.exe patch. Without this patch, telnet ip 1433 will not be able to connect, of course, it will not be connected from the remote client. I was confused all afternoon on this issue.
ODBC of Linux system
UnixODBC-2.2.8.tar.gz (http://www.unixodbc.org)
Connect the driver of SQLServer or Sybase
Freetds-0.62.4.tar.gz (http://www.freetds.org)
2 installation configuration (must be installed by users under root)
1. Install unixODBC
# tar vxzf unixODBC-2.2.8.tar.gz
# cd unixODBC-2.2.8
#. / configure-prefix=/usr/local/unixODBC-enable-gui=no
# make
# make install
2. Install freetds
# tar vxzf freetds-0.62.4.tar.gz
# cd freetds-0.62.4
#. / configure-prefix=/usr/local/freetds-with-unixodbc=/usr/local/unixODBC-with-tdsver=8.0
# make
# make install
3. Configure freetds
# vi / usr/local/freetds/etc/freetds.conf
Modify the following paragraph and remove
The revised content:
[global]
# TDS protocol version
Tds version = 8.0
[SQLServer2000]
Host = 192.168.1.110
Port = 1433
Tds version = 8.0
Client charset = ISO-8859-1
[SQLServerMDM]
Host = SQLCNBJ015.corp.novocorp.net
Port = 3888
# instance = MDM_StagingDB
Tds version = 8.0
Client charset = UTF-8
[SQLServer2000] represents the name of the server used on the client (add-S SQLServer2000 to the tsql command), host represents the IP address of the SQLServer server, and port represents the port. Client charset is the character set used by the client. My machine uses utf-8 to report a connection failure error. I found that tsql can connect successfully using the ISO-8859-1 character set, so this is changed here.
Test the connection:
$tsql-S SQLServer2000-U autotest-P autotest
. / tsql-S SQLServerDEV-U SELASReader-P Only4SELAS
Locale is "en_US"
Locale charset is "ISO-8859-1"
Msg 2403, Level 16, State 0, Server OpenClient, Line 0
WARNING! Some character (s) could not be converted into client "s character set. Unconverted bytes were changed to question marks".
1 > use atsdb
2 > go
1 > select * from auth_function
2 > go
FUNC_ID NAME ENGLISH_NAME PARENT_ID IS_LOG NOTES
1 >
[siebel@appcnbj035 bin] $. / tsql-S SQLServerMDM-U SELASReader-P Only4SELAS
Locale is "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=zh_CN.GB18030;LC_TIME=zh_CN.GB18030;LC_COLLATE=zh_CN.GB18030;LC_MONETARY=zh_CN.GB18030;LC_MESSAGES=zh_CN.GB18030;LC_PAPER=zh_CN.GB18030;LC_NAME=zh_CN.GB18030;LC_ADDRESS=zh_CN.GB18030;LC_TELEPHONE=zh_CN.GB18030;LC_MEASUREMENT=zh_CN.GB18030;LC_IDENTIFICATION=zh_CN.GB18030"
Locale charset is "UTF-8"
Msg 5703, Level 0, State 1, Server SQLCNBJ015\ I01, Line 1
Changed language setting to us_english.
1 > select count (*) from V_Standard_STAFF
2 > go
This indicates that freetds was installed successfully.
4. Configure unixODBC
# cd / usr/local/unixODBC/etc
Add a SQLServer driver to ODBC
# vi / usr/local/unixODBC/etc odbcinst.ini
Write the following:
[ODBC]
Trace = Yes
TraceFile = / tmp/sql.log
ForceTrace = Yes
Pooling = No
[SQLSERVER]
Description = SQLSERVER
Driver = / usr/local/freetds/lib/libtdsodbc.so
Setup = / usr/local/freetds/lib/libtds.so
UsageCount = 1
CPTimeout = 5
CPReuse = 5
FileUsage = 1
Save exit
Add DSN
# vi / usr/local/unixODBC/etc/odbc.ini
Write the following
[ATSDB]
Driver = SQLSERVER
Description = SQLSERVER
Server = 192.168.1.110
Database = atsdb
Port = 1433
[ATSDB] = SQLSERVER
Description = SQLSERVER
Server = SQLCNBJ015.corp.novocorp.net
Database = MDM_StagingDB
Port = 3888
Note that the Driver driver should write the driver name in odbcinst.ini, and Database is the name of the database.
Save and exit.
Test the connection of the ODBC
# bin/isql-v ATSDB autotest autotestCd / usr/local/unixODBC/bin./isql-v ATSDB SELASReader Only4SELASSQL > SQL > quit after reading this article, I believe you have some understanding of "the case of configuring SQLSERVER ODBC under linux". If you want to know more about it, please follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.