Sybase 中文乱码解决办法
来源:互联网 发布:adas算法 编辑:程序博客网 时间:2024/06/06 00:26
1. JDBC连接串要有字符集设置
jdbc:sybase:Tds:192.168.3.11:5000/Wfis_db?charset=cp936
2. 服务器配置成cp936
(1) 使用isql查看当前已经安装的字符集
isql -Usa -Plongtop
>use master
>go
>select id,name from syscharsets
>go
id name
--- ----------------
0 ascii_8
1 iso_1
2 cp850
20 defaultml
21 thaidict
22 iso14651
24 utf8bin
25 binary
39 altnoacc
45 altdict
46 altnocsp
47 scandict
48 scannocp
50 bin_iso_1
50 bin_cp850
51 dict
52 nocase
53 nocasep
54 noaccent
55 espdict
56 espnocs
57 espnoac
59 rusnocs
64 cyrnocs
65 elldict
69 hundict
70 hunnoac
71 hunnocs
73 turknoac
74 turknocs
129 cp932bin
130 dynix
137 gb2312bn
140 cyrdict
155 turdict
161 euckscbn
163 gbpinyin
165 rusdict
179 sjisbin
192 eucjisbn
194 big5bin
(41 rows affected)
从列表中看出没有安装cp936字符集
(2) 查看当前使用的缺省字符集
>sp_configure "default char"
>go
Parameter Name Default Memory Used Config Value
Run Value Unit Type
------------------------------ ----------- ----------- ------------
----------- -------------------- ----------
default character set id 2 0 2
2 id static
缺省字符集的id是2,查看上面的列表,可以得知是cp850
(3) 因为上面的列表中没有安装cp936,所以就安装cp936字符集
进入目录C:\sybase\charsets\cp936
运行命令 charset -Usa -Plongtop binary.srt cp936
运行完成后,系统就安装了cp936字符集
(4) 验证是否确实安装了cp936字符集
isql -Usa -Plongtop
>use master
>go
>select id,name from syscharsets
>go
id name
--- ------------------------------
0 ascii_8
1 iso_1
2 cp850
20 defaultml
21 thaidict
22 iso14651
24 utf8bin
25 binary
39 altnoacc
45 altdict
46 altnocsp
47 scandict
48 scannocp
50 bin_iso_1
50 bin_cp850
50 bin_cp936
51 dict
52 nocase
53 nocasep
54 noaccent
55 espdict
56 espnocs
57 espnoac
59 rusnocs
64 cyrnocs
65 elldict
69 hundict
70 hunnoac
71 hunnocs
73 turknoac
74 turknocs
129 cp932bin
130 dynix
137 gb2312bn
140 cyrdict
155 turdict
161 euckscbn
163 gbpinyin
165 rusdict
171 cp936
179 sjisbin
192 eucjisbn
194 big5bin
(43 rows affected)
从列表中可以发现已经安装了cp936,id是171
(5) 把系统的当前缺省字符集设置为cp936
>sp_configure "default char",171
>go
In changing the default sort order, you have also reconfigured SQL Server's
default character set.
Parameter Name Default Memory Used Config Value
Run Value Unit Type
------------------------------ ----------- ----------- ------------
----------- -------------------- ----------
default character set id 2 0 171
2 id static
(1 row affected)
Configuration option changed. Since the option is static, Adaptive Server must
be rebooted in order for the change to take effect.
Changing the value of 'default character set id' to '171' increases the amount
of memory ASE uses by 6 K.
(return status = 0)
(6) 重启Sybase服务,使更改生效
第一次重启,系统会对已经存在的数据进行转换,转换完成后自动停止服务,只要再次启动服务就可以了。
jdbc:sybase:Tds:192.168.3.11:5000/Wfis_db?charset=cp936
2. 服务器配置成cp936
(1) 使用isql查看当前已经安装的字符集
isql -Usa -Plongtop
>use master
>go
>select id,name from syscharsets
>go
id name
--- ----------------
0 ascii_8
1 iso_1
2 cp850
20 defaultml
21 thaidict
22 iso14651
24 utf8bin
25 binary
39 altnoacc
45 altdict
46 altnocsp
47 scandict
48 scannocp
50 bin_iso_1
50 bin_cp850
51 dict
52 nocase
53 nocasep
54 noaccent
55 espdict
56 espnocs
57 espnoac
59 rusnocs
64 cyrnocs
65 elldict
69 hundict
70 hunnoac
71 hunnocs
73 turknoac
74 turknocs
129 cp932bin
130 dynix
137 gb2312bn
140 cyrdict
155 turdict
161 euckscbn
163 gbpinyin
165 rusdict
179 sjisbin
192 eucjisbn
194 big5bin
(41 rows affected)
从列表中看出没有安装cp936字符集
(2) 查看当前使用的缺省字符集
>sp_configure "default char"
>go
Parameter Name Default Memory Used Config Value
Run Value Unit Type
------------------------------ ----------- ----------- ------------
----------- -------------------- ----------
default character set id 2 0 2
2 id static
缺省字符集的id是2,查看上面的列表,可以得知是cp850
(3) 因为上面的列表中没有安装cp936,所以就安装cp936字符集
进入目录C:\sybase\charsets\cp936
运行命令 charset -Usa -Plongtop binary.srt cp936
运行完成后,系统就安装了cp936字符集
(4) 验证是否确实安装了cp936字符集
isql -Usa -Plongtop
>use master
>go
>select id,name from syscharsets
>go
id name
--- ------------------------------
0 ascii_8
1 iso_1
2 cp850
20 defaultml
21 thaidict
22 iso14651
24 utf8bin
25 binary
39 altnoacc
45 altdict
46 altnocsp
47 scandict
48 scannocp
50 bin_iso_1
50 bin_cp850
50 bin_cp936
51 dict
52 nocase
53 nocasep
54 noaccent
55 espdict
56 espnocs
57 espnoac
59 rusnocs
64 cyrnocs
65 elldict
69 hundict
70 hunnoac
71 hunnocs
73 turknoac
74 turknocs
129 cp932bin
130 dynix
137 gb2312bn
140 cyrdict
155 turdict
161 euckscbn
163 gbpinyin
165 rusdict
171 cp936
179 sjisbin
192 eucjisbn
194 big5bin
(43 rows affected)
从列表中可以发现已经安装了cp936,id是171
(5) 把系统的当前缺省字符集设置为cp936
>sp_configure "default char",171
>go
In changing the default sort order, you have also reconfigured SQL Server's
default character set.
Parameter Name Default Memory Used Config Value
Run Value Unit Type
------------------------------ ----------- ----------- ------------
----------- -------------------- ----------
default character set id 2 0 171
2 id static
(1 row affected)
Configuration option changed. Since the option is static, Adaptive Server must
be rebooted in order for the change to take effect.
Changing the value of 'default character set id' to '171' increases the amount
of memory ASE uses by 6 K.
(return status = 0)
(6) 重启Sybase服务,使更改生效
第一次重启,系统会对已经存在的数据进行转换,转换完成后自动停止服务,只要再次启动服务就可以了。
0 0
- Sybase 中文乱码解决办法
- Sybase 中文乱码解决办法
- Sybase 中文乱码解决办法
- Sybase 中文乱码解决办法和sybase :set IDENTITY_INSERT
- sybase中文乱码解决方案
- sybase中文乱码问题
- sybase中文乱码
- Sybase编码相关---中文乱码
- 解决Sybase库显示中文乱码问题
- Sybase管理工具RazorSQL中文乱码问题
- sybase客户端SqlDbx中文乱码问题解决
- 解决Sybase库显示中文乱码问题
- Cookies中文乱码解决办法
- FCKeditor中文乱码解决办法
- FCKeditor中文乱码解决办法
- DOS 中文乱码解决办法
- Struts2中文乱码解决办法
- struts2 中文乱码解决办法
- oracle笔记1-有效、干净的卸载oracle
- PHP 设计模式(二)
- 利用PLSQ中LODBC Import选项导入Excel数据到数据库表中
- AttributeError: 'Response' object has no attribute 'json'
- HDU 2521 反素数
- Sybase 中文乱码解决办法
- 解决安卓手机搜不到ubuntu13.10下WIFI热点的问题
- 使用Vitamio打造自己的Android万能播放器(3)——本地播放(主界面、播放列表)
- sift 详解
- oracle的sqlnet.ora,tnsnames.ora,listener.ora三个配置文件
- java事务
- linux kernel 启动分析
- shell 字符串处理汇总(查找,替换等等)
- hql 和 sql 区别