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 ...
随机推荐
- 【WebForm】Js调用后台C#方法
因业务的需要,有这么个需求,需要前台的JS传参调用C#后台的方法.现在有这么个方法可以解决,整理如下. 首先,先说一下基本实现,前台用Jquery的ajax将其中的URL后加方法,然后在Data中传递 ...
- 2016 icpc-camp 之旅(一)
啦啦啦,终于前往icpccamp啦! 嗯,该死的飞机居然晚点了! 诶,晚点居然还会发赔偿金! 飞机上没什么好说的,和萌神一起看了5集龙与虎,然后就到了. 讲道理,海南航空感觉一般. 我的座位前面有个平 ...
- Codeforces Round #180 (Div. 2) B. Sail 贪心
B. Sail 题目连接: http://www.codeforces.com/contest/298/problem/B Description The polar bears are going ...
- BZOJ 1295: [SCOI2009]最长距离 spfa
1295: [SCOI2009]最长距离 题目连接: http://www.lydsy.com/JudgeOnline/problem.php?id=1295 Description windy有一块 ...
- javascript 拷贝
拷贝简单分为浅拷贝与深度拷贝,即给定一个对象,生成一个相同的对象. 浅拷贝 function copy(source,destiny){ destiny = destiny || {}; if(typ ...
- Linq lamda表达式Single和First方法
让我们来看看如何对一个整数数组使用 Single 操作符.这个整数数组的每个元素代表 2 的 1 到 10 次方.先创建此数组,然后使用 Single 操作符来检索满足 Linq Lambda表达 ...
- android图片特效处理之模糊效果
这篇将讲到图片特效处理的模糊效果.跟前面一样是对像素点进行处理,算法是通用的,但耗时会更长,至于为什么,看了下面的代码你就会明白. 算法: 一.简单算法:将像素点周围八个点包括自身一共九个点的RGB值 ...
- rsync同步工具学习笔记
rsync同步工具 1.rsync介绍 rsync是一款开源的.快速的.多功能的.可实现全量及增量的本地或远程数据同步备份的优秀工具.rsync软件适用于unix/linux/windows等多种操作 ...
- BootStrap2学习日记16---选项卡内容
代码: <ul class="nav nav-tabs"> <li class="active"><a href="#t ...
- 中科院 2014年GCT考前辅导课程安排
: 2014年GCT考前辅导课程安排 发布时间: 2014-07-14 阅读次数:1225 默认字体 9pt ...