使用ROracle包,查询Oracle数据库中文时,都是乱码,怎么解决?
> library(ROracle)
载入需要的程辑包:DBI
drv <-dbDriver("Oracle")
connect.string <-"(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.5.195)(PORT =1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = userlogdb)))"
con <- dbConnect(drv,username = "webmember", password = "webmem123",dbname = connect.string)
rs <- dbSendQuery(con,"select * from mv_members_2 where rownum < 100")
members <- fetch(rs)
members <- tbl_df(members)> drv <-dbDriver("Oracle")
> connect.string <-"(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.5.195)(PORT =1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = userlogdb)))"
>
> con <- dbConnect(drv,username = "webmember", password = "xxx",dbname = connect.string)
> rs <- dbSendQuery(con,"select * from mv_members_2 where rownum < 100")
> members <- fetch(rs)
> head(members)
ID MOBILE NAME GENDER NAME2 AGE STAR SHENGXIAO MARRIAGE CHILDREN
1 12559101 13933360952 ??? ? ??? ?? ?? ?? ?? ??
2 12559102 13646563633 ??? <NA> ??? ?? ?? ?? ?? ??
3 12559103 18599136029 <NA> <NA> ???? ?? ?? ?? ?? ??
4 12559104 13961205865 ??? ? ??? ?? ?? ?? ?? ??
5 12559105 15252050287 ??? ? ??? ?? ?? ?? ?? ??
6 12559106 13775999672 ??? ? ??? ?? ?? ?? ?? ??
注意:是在Linux环境下,在windows环境下是能正常显示中文的