可能原因一:数据库不支持中文,或者是数据库编码格式和java代码编码格式不一致,这种情况需要修改数据库编码格式:
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;
可能原因二:java代码生成插入语句的时候,已经发生乱码现象,这种只能是修改项目编码格式或者是在数据获取的时候直接转译代码编码格式来实现了。
1:检查数据库编码
2:看下程序sql插入时候的数据是不是已经乱码,如果是就在程序里处理一下,如果没有乱码,就检查一下java项目编码与数据库的编码是否一致