r-dbi / RMySQL

Legacy DBI interface for MySQL
http://cran.r-project.org/package=RMySQL
208 stars 111 forks source link

Turkish characters R to MySQL write problem #118

Open vezir opened 8 years ago

vezir commented 8 years ago

When i try to write a table from R to MySql, all data are written except Turkish letters. such as 'öşı' 'Bluetooth Kulaklı devam'

it is just inserted 'Bluetooth Kulakl' part. MySql version 5.5 R version R version 3.2.1 (2015-06-18)" Platform "x86_64-w64-mingw32"

How can i correct this?

krlmlr commented 8 years ago

Could you please show the output of

con <- dbConnect(MySQL(), dbname = "test")
dbGetQuery(con, "show variables like 'character_set%'")

(substitute "test" with your database name). Related: https://github.com/rstats-db/RMySQL/issues/93.

vezir commented 8 years ago

Here it is

dbGetQuery(con, "show variables like 'character_set%'") Variable_name Value 1 character_set_client utf8 2 character_set_connection utf8 3 character_set_database utf8 4 character_set_filesystem binary 5 character_set_results utf8 6 character_set_server utf8 7 character_set_system utf8 8 character_sets_dir C:\Program Files\MySQL\MySQL Server 5.5\share\charsets\

krlmlr commented 8 years ago

This looks good. Which version of RMySQL are you using?

vezir commented 8 years ago

packageDescription("RMySQL") Package: RMySQL Version: 0.10.7

krlmlr commented 8 years ago

Thanks. Does it work with the current dev version?

devtools::install_github(c("rstats-db/DBI", "rstats-db/RMySQL"))
vezir commented 8 years ago

I installed with your command but now i could not connect to DB :)

drv<-dbDriver("MySQL") con<-dbConnect(drv,user="hakan",password="hakan",dbname="test", characterEncoding='UTF-8') Error in .Call("RMySQL_connection_create", PACKAGE = "RMySQL", host, user, : "RMySQL_connection_create" not available for .Call() for package "RMySQL" con <- dbConnect(MySQL(), user="hakan",password="hakan",dbname="test", characterEncoding='UTF-8') Error in .Call("RMySQL_connection_create", PACKAGE = "RMySQL", host, user, : "RMySQL_connection_create" not available for .Call() for package "RMySQL"

krlmlr commented 8 years ago

Could you please try

dbConnect(RMySQL::MySQL(), ...)

Also, did you have Rtools installed when you installed DBI and RMySQL from GitHub?

vezir commented 8 years ago

No, i have installed it before. Rtools Collection 3.3.0.1958 do you mean reinstalling it?

krlmlr commented 8 years ago

No, that's fine. Does dbConnect(RMySQL::MySQL(), ...) work?

vezir commented 8 years ago

No, i think it is same problem with https://github.com/rstats-db/RMySQL/issues/64

vezir commented 8 years ago

Just for clarification, the issue is not the same problem with #64, but after trying to install dev version to solve the problem related with turkish letters i can not connect to db now. Connection problem is related with #64.

krlmlr commented 8 years ago

Thanks, I see your point. I have started to work on #64 in a branch, but unfortunately my changes so far don't seem to resolve the issue just yet. So far I've only tested on AppVeyor, which is a tad cumbersome -- I'd appreciate any help on that matter.

erdemayaz commented 6 years ago

Sorunu çözebildiniz mi acaba? Ben de R'ye yeni başladım, böyle bir sorunla karşılaştım. Sorun veritabanında değil sanırım R tarafında.

erdemayaz commented 6 years ago

I just solved same problem. Encoding(datatable$column) <-"WINDOWS-1254"