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, the database file is Atsdb
Attention:
1 MS has never provided SQL Server for Linux, so don't try to install SQL Server on a Linux system, but you can connect via ODBC
SQL Server database for Windows system;
2 installed SQLServer2000 will not open the 1433 port, so Windows XP users must install SQL Server after the installation of SQL Server SP3 pudding, you can use the command netstat-a to see whether to open 1433 ports
3 for Windows XP, the default firewall is not to allow 1433 ports to communicate, so you must turn off Windows firewalls, this problem toss me one day, the connection is not successful, I think it is an ODBC software configuration problem, the lesson. The most exasperating thing is that the other Windows machines use SQL Server's command isql to access the database (without shutting down the firewall). By grasping the package tool to find that there is no 1433-port communication, but through the 445 or 139 internal port communication Ah, it seems to be windowns things are good, but also too overbearing
4 in the XP SP2 installation sqlserver2000 must play Chs_sql2ksp3.exe patch, if not this patch, Telnet IP 1433 will not connect, of course, from the remote client connection, on this issue toss an afternoon, dizzy Ah
ODBC for Linux Systems
Unixodbc-2.2.8.tar.gz (http://www.unixodbc.org)
Connect to SQL Server or Sybase driver
Freetds-0.62.4.tar.gz (http://www.freetds.org)
Two installation configuration (must be installed under the root user)
1. Installation 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. Installation 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 it.
After the change of the 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 server name that is used on the client (to join-s SQLServer2000 in the TSQL command), the host represents the IP address of the SQL Server servers, and port represents the ports. Client CharSet Is the character set used by the client, my machine using Utf-8 will report the failure of the connection, found that tsql use the ISO-8859-1 character set can connect successfully, so here also changed to this
To 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, state 0, Server Openclient, line 0
warning! Some character (s) could is 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 the installation FreeTDS succeeded
4. Configure UNIXODBC
# CD/USR/LOCAL/UNIXODBC/ETC
Add SQL Server driver to ODBC
# vi/usr/local/unixodbc/etc Odbcinst.ini
Write the following:
[ODBC]
Trace = Yes
Tracefile =/tmp/sql.log
Forcetrace = Yes
pooling = No
[SQL Server]
Description = SQL Server
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 to the following content
[Atsdb]
Driver = SQL Server
Description = SQL Server
Server = 192.168.1.110
Database = Atsdb
Port = 1433
[ATSDB] = SQL Server
Description = SQL Server
Server = SQLCNBJ015.corp.novocorp.net
Database = Mdm_stagingdb
Port = 3888
Note that the driver driver will write the driver name in Odbcinst.ini, and the database is the name
Save and exit.
To test ODBC connections
bin/isql-v atsdb autotest autotest cd/usr/local/unixodbc/bin./isql-v ATSDB Der Only4selas sql> sql> quit