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 ...
随机推荐
- javascript计算字符串的字节长度
String.prototype.byteLen = function(){ var len = 0, i = this.length; while(i--) { len += (this.charC ...
- UVA1099----Sharing Chocolate----在集合上的DP
题目地址:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- TP复习17
三大自动,自动创建,自动验证,自动完成
- Linux网卡高级命令、IP别名及多网卡绑定 转
http://www.cnblogs.com/xiaoluo501395377/archive/2013/05/26/3100065.html 本篇随笔将详细讲解Linux系统的网卡高级命令.IP别名 ...
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
和机器字长及编译器有关系: 所以,int,long int,short int的宽度都可能随编译器而异.但有几条铁定的原则(ANSI/ISO制订的): 1 sizeof(short int)<= ...
- fir.im Weekly - 2016 移动开发技术大回顾
2016 年是移动技术发展迅速的一年,认认真真回顾这一年必不可少.@移动开发前线 的 这篇 2016移动开发技术巡礼 ,精心盘点了 2016 年 移动开发技术大事件,分为 iOS/Android平台篇 ...
- 项目源码--Android即时通讯IM客户端
下载源码 技术要点: 1.完整精美客户端UI设计 2.自定义控件的灵活使用 3.UI控件的详细使用 4.即时通讯IM协议的实现 5.完整即时通讯IM客户端实现 6.源码详细的中文注释 ……. ...
- Spring MVC 中 HandlerInterceptorAdapter的使用--转载
原文地址:http://blog.csdn.net/liuwenbo0920/article/details/7283757 一般情况下,对来自浏览器的请求的拦截,是利用Filter实现的,这种方式可 ...
- Linux 的启动流程
转载:http://www.ruanyifeng.com/blog/2013/08/linux_boot_process.html 更多文档参见:http://pan.baidu.com/s/1hqo ...
- The Socket API, Part 3: Concurrent Servers
转:http://www.linuxforu.com/2011/10/socket-api-part-3-concurrent-servers/ By Pankaj Tanwar on October ...