Home:ALL Converter>RODBC on an Oracle Database and special characters

RODBC on an Oracle Database and special characters

Ask Time:2015-06-10T23:44:40         Author:Corabox

Json Formatter

Sorry if I ask a question that has already been ask, I effectively found some similar questions (like Special characters and RODBC for example) in this forum but no answer help me...

So, my problem is that when I make a query on an Oracle database, via RODBOC in R, I can't see correctly the special characters in return. R automatically convert (when it can) special characters to normal characters

Here is a simple test that I made :

> Cnx <- odbcConnect(dsn="myDSN", uid="myLogin",pwd="myPassword")
> sqlQuery(Cnx, paste("SELECT 'eéèêëÄÊÍÕØ' col FROM DUAL"))
         COL
1 eeeeeAEI??

I'm under Win7 x64, "myDSN" is an ODBC connection which uses the "Oracle in OraClient12home1" (64 bits). I use "R x64 3.2.0" with RODBC package version 1.3-11. The database is on linux server, is NLS_CHARACTERSET is "WE8MSWIN1252"

I've made other tests to understand better :

  • Same test with an ODBC connection which uses the "Oracle in OraClient12home1_32bit" with "R i386 3.2.0" => Same problem
  • Same test with an ODBC connection on local SQL server => No problem, I can see the specials characters
  • Same query with the same ODBC connection in MS Excel => No problem too

I tried to play with the DBMSencoding parameter, with "UTF-8" I get the same problem, with others, I get different errors...

Here is my sessionInfo()

R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                   LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RODBC_1.3-11

loaded via a namespace (and not attached):
[1] tools_3.2.0

Thank's for your help

Author:Corabox,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30761167/rodbc-on-an-oracle-database-and-special-characters
yy