4

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

Community
  • 1
  • 1
Corabox
  • 157
  • 10
  • Welcome to SO. With R questions it's often helpful to provide a [minimal reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) so others can replicate your issue. – Phil Jun 10 '15 at 15:52
  • @Phil I'm not sure what more you want them to provide...? In order to "reproduce" it you'd need an Oracle data base. Are you suggesting the OP include an Oracle db installation in the question? ;) – joran Jun 10 '15 at 15:56
  • Have a read of the post I linked to. Basically, SO users should be able to come along, copy a block of code from your post, and replicate your issue so they can help you find a solution. – Phil Jun 10 '15 at 16:01
  • @Phil Yes, I'm well aware of that post. My point is that for some questions, such as those involving an external data base, that's _not possible_. This question is perfectly reproducible (because I have access to an Oracle db). I can copy+paste their query and see there error just fine. Or are you suggesting that the OP should include "code" that you can copy+paste on your machine that will download, install and configure an entire Oracle data base instance? Because that's absurd. – joran Jun 10 '15 at 16:18
  • @joran I thought you were the OP when I read your comment so didn't realise you were aware of that post. I think the OP's question is good, hence I upvoted it. – Phil Jun 11 '15 at 09:36

0 Answers0