Questions tagged [r-dbi]

DBI is an R package providing a common interface to several databases (currently MySQL, PostgreSQL, SQLite and Oracle are supported, as well as JDBC connections).

DBI is an package providing a common interface to several databases (currently , , and are supported, as well as connections).

Repositories

Other resources

Packages that extend DBI

Users don't often work directly with DBI; you probably want one of these

Related tags

272 questions
0
votes
0 answers

Trouble accessing recently created ODBC table

I have started using DBI and RODBC packages as a way to talk to the ODBC interface and write a dataframe as a ODBC table to be accessible during queries. My problem is, while I can write a table by using either dbWriteTableor sqlSave, I can't…
André Oviedo
  • 51
  • 1
  • 5
0
votes
0 answers

R SQL Server odbc and DBI unicode table names

I have the following R code used to connect to a MS SQL Server. My table and column names contains unicode characters. And they appear odd when written to the database from R. library(odbc) library(DBI) conn <- DBI::dbConnect(odbc::odbc(),…
CodeMonkey
  • 3,418
  • 4
  • 30
  • 53
0
votes
0 answers

Encoding write db issue to SQL after 1024 row

I'm trying to write table to MS SQL Server from R using DBI with Cyrillic words. All looking good but when I write more then 1024 rows I have issue with encoding. I'm try next drivers : Microsoft ODBC Driver 17 for SQL Server ODBC Driver 13 for…
jyjek
  • 2,627
  • 11
  • 23
0
votes
1 answer

MariaDB - UPDATE/DELETE fails silently

My data table sits in AWS-RDS under a MariaDB instance and looks as follows: | id | first | second | third | fourth | fifth | sixth | |----|-------|--------|-------|--------|-------|-------| | 3 | foo | foo | foo | foo | 1 | foo | |…
Joe Catin
  • 33
  • 3
0
votes
1 answer

Prepared statement in R - dbSendQuery does not work with dates

I am trying to write a prepared statement with dbSendQuery. My issue is that the data frame of inputs are converted to numeric values, but two of the three inputs are dates. This results in the following error message: Warning: Error in…
Toby Tan
  • 1
  • 1
0
votes
1 answer

Can't get data with dbplyr from shiny-server

I'm trying to get data from AWS SQL Server. This code works fine from local PC, but it didn't work from shiny-server (ubuntu). library(dbplyr) library(dplyr) library(DBI) con <- dbConnect(odbc::odbc(), driver = "FreeTDS", …
jyjek
  • 2,627
  • 11
  • 23
0
votes
1 answer

dbGetQuery and dbReadTable failing to return a really large table DBI

I have a really large table (8M rows) that I need to import in R on which I will be doing some processing. Problem is when I try to bring it in R using the DBI package I get an error My code is below options(java.parameters = "-Xmx8048m")…
0
votes
1 answer

dbSendQuery INSERT statement with text

I'm trying to use dynamic insert statements with my database but it fails on character columns. See code below. library(dplyr) library(DBI) library(pool) library(RSQLite) df1 <- data.frame(stringsAsFactors = F, id = 1:4, value = letters[1:4]) df2…
Spencer
  • 107
  • 9
0
votes
1 answer

DBI get query problems when string contain UTF-8 characters in R

I am sending this query to a MySQL database using following function: loadDataBudget <- function(korisnik, razinaLabel) { lapply( dbListConnections( dbDriver( drv = "MySQL")), dbDisconnect) # Connect to the database db <- dbConnect(MySQL(),…
Mislav
  • 1,533
  • 16
  • 37
0
votes
0 answers

Every time I source my R script it leaks a db connection

I cannot paste the entire script here, but I am explaining the situation. If you have ever got leaked DB connections then you would be knowing what I am talking about. I have an R script file that has many functions (around 50) that use db…
Lazarus Thurston
  • 1,197
  • 15
  • 33
0
votes
1 answer

Read tables from MySQL databases into R

I'm trying to read tables from my database with DBI package in R : mydb = dbConnect(MySQL(), user='root', password='*******', dbname='powercurve', host='127.0.0.1') dbReadTable(mydb,"3.4m140sco") But apparently the tables name are not allowed in R…
Ali Hadjihoseini
  • 941
  • 1
  • 11
  • 31
0
votes
1 answer

How to make S4 class from another package available to my package?

I'm following Hadley's guide to implement a DBI backend, which instructs me to build S4 classes that inherit from DBI classes. From the instructions, to make the DBI classes available, it seems that I only have to list DBI as an import in the…
Heisenberg
  • 8,386
  • 12
  • 53
  • 102
0
votes
0 answers

Consistently change format of DATE columns to CHAR

Within R I am receiving tables from an Oracle database. However, unfortunately something is going wrong in the conversion within ROracle: dates are converted to POSIXct but for some strange reason same dates can differ by one hour (see my other post…
N Meibergen
  • 362
  • 2
  • 14
0
votes
1 answer

SparklyR/Spark SQL split string into multiple columns based on number of bites/character count

I have a spark dataframe TABLE1 with one column with 100000 rows each contains a string of the identical length AA105LONDEN 03162017045262017 16953563ABCDEF and I would like to separate each row into multiple columns based on the lines…
Levi Brackman
  • 325
  • 2
  • 17
0
votes
1 answer

How to connect R DBI package to SQL Server?

I'm currently using the RODBC package in R to run queries against SQL Server databases. Knitr now has the ability to use SQL code chunks (using the DBI package). I'd like to take advantage of this, as it allows me to have clean SQL embedded in my…
John Tarr
  • 717
  • 1
  • 9
  • 21