oracle 11g 中文乱码
答案:3 悬赏:60 手机版
解决时间 2022-01-01 12:06
- 提问者网友:城市野鹿
- 2021-12-31 16:12
SSH2做一个保存的功能,有两个表,这两个表内容差不多,2表比1表多几个字段而已。。。分别往这两个页面插入中文,第一个页面正常,第二个页面中文就乱码,这是为什么啊。。字段的类型设置的都没问题,2表是通过1表拷贝粘贴过来的,两个表除了内容,不存在任何的差异。。
最佳答案
- 五星知识达人网友:天凉才是好个秋
- 2021-12-31 17:00
出现这种原因最大可能就是数据库编码格式不支持中文,修改一下编码格式为UTF-8即可:
sql> conn / as sysdba;
sql> shutdown immediate;
database closed.
database dismounted.
oracle instance shut down.
sql> startup mount;
oracle instance started.
total system global area 135337420 bytes
fixed size 452044 bytes
variable size 109051904 bytes
database buffers 25165824 bytes
redo buffers 667648 bytes
database mounted.
sql> alter system enable restricted session;
system altered.
sql> alter system set job_queue_processes=0;
system altered.
sql> alter system set aq_tm_processes=0;
system altered.
sql> alter database open;
database altered.
sql> alter database character set internal_use UTF-8;
sql> shutdown immediate;
sql> startup; 备注:如果是传递过来的数据就是乱码,这种更改编码是不起作用的,
sql> conn / as sysdba;
sql> shutdown immediate;
database closed.
database dismounted.
oracle instance shut down.
sql> startup mount;
oracle instance started.
total system global area 135337420 bytes
fixed size 452044 bytes
variable size 109051904 bytes
database buffers 25165824 bytes
redo buffers 667648 bytes
database mounted.
sql> alter system enable restricted session;
system altered.
sql> alter system set job_queue_processes=0;
system altered.
sql> alter system set aq_tm_processes=0;
system altered.
sql> alter database open;
database altered.
sql> alter database character set internal_use UTF-8;
sql> shutdown immediate;
sql> startup; 备注:如果是传递过来的数据就是乱码,这种更改编码是不起作用的,
全部回答
- 1楼网友:人類模型
- 2021-12-31 19:06
如果是发现保存到数据库这个过程中乱码, 那么应该是myEclipse的字符集编码环境的问题。在myEclipse中右键单击 第一个文件、第二个文件,打开属性页找到字符集编码这条属性。将第二个页面文件的属性与第一个保持一致,即可。
- 2楼网友:患得患失的劫
- 2021-12-31 18:22
说明数据库不支持中文,修改为gbk或者utf-8就可以了。
alter system disable restricted session;改完编码后执行
sql> conn / as sysdba;
sql> shutdown immediate;
database closed.
database dismounted.
oracle instance shut down.
sql> startup mount;
oracle instance started.
total system global area 135337420 bytes
fixed size 452044 bytes
variable size 109051904 bytes
database buffers 25165824 bytes
redo buffers 667648 bytes
database mounted.
sql> alter system enable restricted session;
system altered.
sql> alter system set job_queue_processes=0;
system altered.
sql> alter system set aq_tm_processes=0;
system altered.
sql> alter database open;
database altered.
sql> alter database character set internal_use utf-8;
sql> shutdown immediate;
sql> startup;查看数据库编码格式:select userenv('language') from dual;
如果数据库格式支持中文,那么就要看下执行的sql是不是本身就有乱码了。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯