[R] RMySQL and german umlaute

Sven Garbade sven.garbade at evall.org
Fri Mar 30 19:27:41 CEST 2012


Hi list,

I have some trouble to setup RMySQL correctly to work with german umlaute:

> library(RMySQL)
Loading required package: DBI
> pg <- dbDriver("MySQL")
> con <- dbConnect(pg, username="dummy", host="localhost", password="",
dbname="ga1prosp")
> dbGetQuery(con, statement="SELECT *  FROM Körpermaße;")
Error in mysqlExecStatement(conn, statement, ...) : RS-DBI driver:
(could not run statement: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near '\266rpermaße' at line 1)

The table "Körpermaße" has encoding utf8, and query "SELECT *  FROM
Körpermaße;" runs fine from mysql-monitor or in Emacs MySQL-mode.

MySQL Version: Ver 14.16 Distrib 5.1.50-MariaDB, for pc-linux-gnu
(x86_64), R sessionInfo():

R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8   
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8  
 [7] LC_PAPER=C                 LC_NAME=C                
 [9] LC_ADDRESS=C               LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C      

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

other attached packages:
[1] gard_1.0       lattice_0.20-6 mblm_0.11      RMySQL_0.9-3  
DBI_0.2-5    
[6] mapdata_2.2-1  maps_2.2-5     xtable_1.7-0 

loaded via a namespace (and not attached):
[1] grid_2.14.2  tools_2.14.2

Any ideas what goes wrong?
Thanks, Sven



More information about the R-help mailing list