Home>

A test environment

Operating system red hat as 5.5

database

sqlserver2000 installed in windows xp professional, I assume that the database has the user autotest password is autotest and the database file is atsdb

note:

1ms never provided sqlserver for linux, so don't try to install sqlserver on linux system, but you can connect through odbc

sqlserver database of windows system;

2 The installed sqlserver2000 will not open port 1433, so please 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 you must turn off the windows firewall,This problem tossed me all day,Always connecting unsuccessfully,I thought it was a problem with the configuration of the odbc software. The most annoying is that using the sqlserver command isql on other windows machines can access the database,(Do not turn off the firewall). It is found through the packet capture tool that communication is not through the 1433 port at all.But through the internal port 445 or 139,How terribleIt seems the windowsdown stuff is good,But it's too domineering

4 chs_sql2ksp3.exe patch must be applied when installing sqlserver2000 in XP SP2.telnet ip 1433 will not connect,Of course, you cannot connect from a remote client.Tossing this afternoon for an afternoon,Dizzy

odbc for linux

unixodbc-2.2.8.tar.gz ()

Driver for connecting to sqlserver or sybase

freetds-0.62.4.tar.gz ()

Two installation configuration (must be installed by the user 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 put;remove

After the change:

[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 used in 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 will report a connection failure error when using UTF-8.Found that tsql can connect successfully using the iso-8859-1 character set,So here it is too

Test 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>

[[email protected] bin] $./tsql -s sqlservermdm -u selasreader -p only4selas

locale is "lc_ctype=en_us.utf-9;.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 shows that the installation of freetds was successful

4.Configure unixodbc

#cd/usr/local/unixodbc/etc

Add 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 and 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 should write the driver name in odbcinst.ini,database is the name of the database

Save and exit.

Test odbc connection

#bin/isql -v atsdb autotest autotest
cd/usr/local/unixodbc/bin
./isql -v atsdb selasreader only4selas
sql>
sql>quit
  • Previous asp knowledge finishing notes 4 (question and answer mode)
  • Next Comprehensive interpretation of inner classes in Java programming