Linux下用freetds连接mssql中文乱码的问题【参考1】
系统: Linux
数据库: Sql Server 2005
官方网站:http://www.freetds.org
2.安装FreeTDS
# tar zxvf freetds-current.tgz(解压)
# ./configure --prefix=/usr/local/freetds --with-tdsver=7.2 --enable-msdblib
# make
# make install
--enable-dbmfix --with-gnu-ld --enable-shared --enable-static
4.2 Sybase SQL Server < 10 and Microsoft SQL Server 6.5
5.0 Sybase SQL Server >= 10
7.0 Microsoft SQL Server 7.0
7.1 Microsoft SQL Server 2000
7.2 Microsoft SQL Server 2005
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".
# server specific section
[global]
# TDS protocol version
; tds version = 4.2
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff
; timeout = 10
; connect timeout = 10
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
client charset=utf8
#[egServer50]
# host = symachine.domain.com
# port = 5000
# tds version = 5.0
#[egServer70]
# host = ntmachine.domain.com
# port = 1433
# tds version = 7.0
[Server2005]
host = 192.168.3.100 #我的SQL Server2005 IP,根据自己改
port = 1433
tds version = 7.2
[root@test bin]# ./tsql -S Server2005 -p 1433 -U java -P java -D PublicDB
locale is "zh_CN"
locale charset is "GB2312"
Default database being set to PublicDB
1>
出现这个表示连接成功! 退出:quit 和 exit 都行.
-S 配置的服务名
-H 主机名
-p 端口
-U username
-P password
-D database
# ./tsql -S Server2005 -p 1433 -U java -P java -D PublicDB
2> go
重新编译php 这些参数根据自己情况来定,下面是我们需要的
但是必须带--with-mssql=/usr/local/freetds
./configure
--prefix=/usr/local/php --with-mysql=/usr/local/mysql
--with-apxs2=/usr/local/apache/bin/apxs --with-gd=/usr/local/gd
--with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng
--with-zlib-dir=/usr/local/zlib --with-libxml-dir=/usr/local/libxml2
--with-iconv=/usr/local/libiconv --with-freetype-dir=/usr/local/freetype
--with-pdo-mysql=/usr/local/phpbak/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so
--enable-sockets --with-curl --with-pear
--with-mssql=/usr/local/freetds
# touch /usr/local/freetds/include/tds.h
# touch /usr/local/freetds/lib/libtds.a
/**
* MOIT
*
* @author 明白(admin126com@126.com) 日 期: Wed Nov 18 05:00:07 GMT 2009
* @copyright Copyright (c) 2009
* @desc 测试
$msdb=mssql_select_db("PublicDB",$msconnect);
$msquery = "select TRUE_NAME,USER_ID,USER_NAME,PASSWORD from USER_INFO";
$msresults= mssql_query($msquery);
while ($row = mssql_fetch_array($msresults)) {
echo $row['USER_ID'] . " ".$row['TRUE_NAME']. " " . $row['USER_NAME'] . " " . $row['PASSWORD'] . "<br>\n";
}
?>
Linux下用freetds连接mssql中文乱码的问题【参考1】的更多相关文章
- Linux下用freetds连接mssql中文乱码的问题【参考2】
php5.3的情况下,用pdo的dblib驱动无法连接mssql的,根据官方的描述,5.2已经修改这个bug,5.3没有. 用php自带的mssql函数可以的.编译freetds,php_mssql, ...
- 解决在Linux下安装Oracle时的中文乱码问题
本帖最后由 TsengYia 于 2012-2-22 17:06 编辑 解决在Linux下安装Oracle时的中文乱码问题 操作系统:Red Hat Enterprise Linux 6.1数据库:O ...
- [转载] linux下打开windows txt文件中文乱码问题
原文链接 在linux操作系统下,我们有时打开在windows下的txt文件,发现在windows下能正常显示的txt文件出现了中文乱码. 出现这种情况的原因为两种操作系统的中文压缩方式不同,在win ...
- linux下打开windows txt文件中文乱码问题 (转载)
转自:http://blog.csdn.net/imyang2007/article/details/7448177 在linux操作系统下,我们有时打开在windows下的txt文件,发现在wind ...
- Linux 下 zip 文件解压中文乱码
windows下的中文文件名拷贝到ubuntu下面以后,文件名直接变成乱码,原因为windows下的文件名以GBK编码,而Ubuntu下的文件 名为utf-8编码 1. ubuntu下有一个工具可以用 ...
- linux下javadoc生成文件出现中文乱码
javadoc命令的正确使用姿势 javadoc -d apidoc -windowtitle Testing -doctitle 'The API of javadoc' -header 'My c ...
- Linux下使用FreeTDS访问MS SQL Server 2005数据库(包含C测试源码)
Linux下使用FreeTDS访问MS SQL Server 2005数据库(包含C测试源码) http://blog.csdn.net/helonsy/article/details/7207497 ...
- Linux下通过ODBC连接sqlserver
Linux下通过ODBC连接sqlserver 1.需求: 最近有个需求就是要在linux下连接(可以执行sql语句)sqlserver 2.环境 操作系统: Centos6.5 数据库: ...
- linux下列出所有连接到你的Server的IP地址
linux下列出所有连接到你的Server的IP地址 最近要做一个检查所有连接到主机的IP的脚本,google到一篇老外写的文章 <List all IP addresses connected ...
随机推荐
- Python 存储模型
1.Python彻底分离了对象和引用,可以认为内存中的对象都是不可修改的,每次修改引用,相当于在堆上重新创建一个对象,引用指向新对象. 2.对于数值和字符串,修改意味着引用指向一个新对象. 3.集合中 ...
- \r,\n,\t
\r:回车符,返回到这一行的开头,return的意思. \n:换行符,到下一行的同一位置,纵坐标相同,new line的意思. \t:制表符,为了在不使用表格的情况下,上下对齐,table的意思. E ...
- Codeforces Good Bye 2015 A. New Year and Days 水题
A. New Year and Days 题目连接: http://www.codeforces.com/contest/611/problem/A Description Today is Wedn ...
- UTF-8 BOM(EF BB BF)
原标题:link标签和script标签跑到body下面,网页顶部有空白,出现“锘匡豢”乱码,UTF-8 BOM,EF BB BF 来自:http://tunps.com/link-and-script ...
- iOS 设计模式之抽象工厂
设计模式是程序提升的必备知识,这里说下iOS怎样实现抽象工厂设计模式.本文是看过oc编程之道这本的抽象工厂这章后写出的,假设不明确原理能够看看那本书. TestView.h首先创建一个视图 // // ...
- 深入NGINX:我们如何设计它的性能和扩展性
为了更好地理解设计,你需要了解NGINX是如何工作的.NGINX之所以能在性能上如此优越,是由于其背后的设计.许多web服务器和应用服务器使用简单的线程的(threaded).或基于流程的 (proc ...
- Eclipse中SVN的安装步骤(两种)和用法
一.给安装EclipseSVN,最常见的有两种方式:手动方式和使用安装向导方式.详细过程例如以下: 方式一:手动安装 1.从官网下载site-1.6.9.zip文件,网址是:subclipse.tig ...
- android获取/更改gps和WIFI状态
一.WIFI状态的获取和更改 适用于 SDK1.0 , SDK1.5 1.获取WIFI状态 方法1:通过WifiManager进行操作 1WifiManager wifiManager = (Wifi ...
- iOS执行时工具-cycript
cycript是大神saurik开发的一个很强大的工具,能够让开发人员在命令行下和应用交互,在执行时查看和改动应用.它确实能够帮助你破解一些应用,但我认为这个工具主要还是用来学习其它应用的设计(主要是 ...
- iOS开发——图层OC篇&Quartz 2D各种绘制实例
Quartz 2D各种绘制实例 首先说一下,本篇文章只是介绍怎么使用Quartz 2D绘制一些常用的图像效果,关于Quartz和其他相关技术请查看笔者之前写的完整版(Quartz 2D详解) 一:画线 ...