SeeArticle: Http://space.itpub.net/82392/viewspace-238018
However, some functions cannot be used because they are too old.
# Install Perl
Yum install-y Perl *
# Install unixodbc
### Install the support library as needed
### Yum-y install automake Autoconf libtool
Wget FTP://Ftp.unixodbc.org/pub/unixodbc/unixodbc-2.3.1.tar.gzGunzipUnixodbc *.Tar. GZTarXvf unixodbc *.TarCD unixodbc-2.3.1./Configure -- prefix =/usr/local/unixodbc -- enable-Gui = NoMake Make Install
# Install the driver connecting to sqlserver or Sybase
WgetFtp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz
TarVxzf freetds-stable.tgz
CD freetds-0.91/
./Configure -- prefix =/usr/local/freetds -- With-unixodbc =/usr/local/unixodbc -- With-tdsver = 8.0
Make
Make Install
Configure freetds. conf
Vim/usr/local/freetds/etc/freetds. conf# If the configuration file cannot be found, find/-name freetds. conf is available.
Add the following content:
[Sqlservercd] Host=# Hidden database IP address # Port=# Hidden Port # TDS version= 7.1
After that, you can test whether freetds can be successfully connected.
/Usr/local/freetds/bin/tsql-SSqlservercd-H# Hidden database IP address ##-P# Hidden Port ##-U # hidden username #-P # hidden password ##
# Install DBD-ODBC
Export odbchome =/usr/local/unixodbc
WgetHttp://mirrors.btte.net/CPAN/authors/id/M/MJ/MJEVANS/DBD-ODBC-1.37.tar.gzTar-Xzf DBD-ODBC-1.37.tar.gz
CDDBD-ODBC-1.37
Perl makefile. pl-O/usr/local/unixodbc
Make
Make Install
# Configure unixodbc
CD/usr/local/Unixodbcvim etc/Odbcinst. ini ##### Add the following content: [freetds] Driver=/Usr/local/freetds/lib/Libtdsodbc. So ##### save Vim etc/ODBC. ini ##### Add the following content [server1] Driver=Freetds; corresponds to the above freetds Server=# Hidden server address # Port=# Hidden Port Number # tds_version=7.2This item must be added; otherwise, what unexpect EOF ~~ will be reported to you ~~~ I found this item for almost two hours...
Complete the test:
Bin/iSQL-VServer1 ## hidden users #### hidden passwords ##
Then, share the ODBC Connection Library
CP/usr/local/unixodbc/lib/libodbc. */usr/lib
Test Perl
Vim test. pl
#! /Usr/bin/PerlUse dBi; $ DBH= DBI-> connect ('DBI: ODBC: server1', '# Hidden users ##',' # hidden passwords ##'); My $…= $ DBH-> prepare ("Select * from table"); $……->Execute ();While(@ DATA = $ something->Fetchrow_array () {print"$ Data [0] $ data [1] $ data [2] \ n";}
Save. Then explain the run
Perl test. pl