Questions tagged [rodbc]

RODBC provides an ODBC database interface for R. The CRAN package provides access to any Open DataBase Connectivity (ODBC) accessible database.

RODBC is an package providing an interface to database sources supporting an ODBC interface. This is very widely available, and allows the same R code to access different database systems. RODBC runs on /, and , and almost all database systems provide support for . The supported systems include , , , , and .

Repositories

Vignettes

Other resources

Related tags

802 questions
5
votes
2 answers

RODBC command 'sqlQuery' has problems with table variables in t-SQL

I am using the RODBC package which I am applying on a Microsoft SQL Server 2012. Now I have discovered a phenomenon that puzzles me. If I run the following query with the RODBC command sqlQuery, then, in R, I will get back an empty data frame with…
Andro
  • 53
  • 1
  • 4
5
votes
1 answer

Are there SQL datatypes that don't work with R?

I am trying run an sqlQuery in Rstudio which seems to crash the program. I want to use the RODBC package to import a name called package name and elapsed time from a Oracle database. When I try to do an sqlQuery such as the following dataframe <-…
5
votes
1 answer

RODBC Connection becomes invalid

I am testing a new database system using a provided ODBC driver and the RODBC package. The issue I am encountering is that after only a few queries (all within the span of 2~3 minutes or less), the connection is no longer recognized as valid by…
Ricardo Saporta
  • 54,400
  • 17
  • 144
  • 178
5
votes
3 answers

RODBC Cannot allocate memory

Simple R script library(RODBC) odbChannel <- odbcConnect(dsn = "CTPRD03", uid = "BD_RPT_RO", pwd = "****") df.test <- sqlQuery(channel = odbChannel, query = "select * from DUAL;") df.test close(odbChannel) Produces the following…
klaasb01
  • 101
  • 1
  • 7
5
votes
1 answer

How can I delete records from an ODBC database based on a dataframe in R

I have a dataframe in R that has a list of records. I would like to delete all of the matching records from my ODBC datasource. data_to_delete ##This is my dataframe delete from RODBC datasource where record_id IN (select record_id …
rascale
  • 79
  • 1
  • 6
5
votes
3 answers

Connecting to Oracle from R on a Mac

I have been trying to setup a connection to an Oracle database from R. Works great from Windows and Linux, but can't seem to get it to work on a Mac. Here is another article from which I followed the instructions with no luck. I would prefer to use…
jbryer
  • 1,747
  • 3
  • 16
  • 29
5
votes
1 answer

"Too few parameters" trying to connect to a Microsoft Access database in R

I'm using RODBC to connect to a microsoft access database. Some queries work fine, but on one I keep getting the errors: 07002 -3010 [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. [RODBC] ERROR: Could not SQLExecDirect…
JaredL
  • 1,372
  • 2
  • 11
  • 27
5
votes
1 answer

sqlSave Updating Oracle DB Table -not working for Date field

I have a Dataset as below > head(resultsclassifiedfinal_MC_TC_P1) FEEDBACK_NUMBER Biz_Div_Num ACCURACY Category_Num CLASSIFIED_BY ACTIVE_IND CRT_BY_USR_NUM 1 20140211-1173 556 99.48% 2303 CMC 1 …
Prasanna Nandakumar
  • 4,295
  • 34
  • 63
5
votes
2 answers

How to upload an image to SQL Server in R

I am creating some graphs which I want to update into a database table. The procedure I am following is: create the graphs as a png/jpeg file. Read that file as a binary vector sqlUpdate My code for steps 2 & 3: pngfile <- file(, "rb") N…
user276920
5
votes
3 answers

RODBC: merge tables from different databases (channel)

I'm using RODBC package to connect to Oracle databases from R but I didn't succeed in merging tables from different databases without "downloading" the tables (I don't want to download them as they are too big!). I'd like to use something…
5
votes
2 answers

RODBC does not save greater than 8k varchar/text from a data frame

I am scraping web data and some results are more than 8K of text. I have a field in my MS SQL Server 2008 R2 that is varchar(max) but RODBC only saves 8K and truncates the rest. I have DSN connections set up using both SQL Native Client 10 from SS…
4
votes
3 answers

Getting SQL stored procedure results into data.frame format using RODBC

I am using the RODBC package to query for results in my SQL server. I have a certain stored procedure written that, when executed in my SQL Server Mgmt. studio (for example), returns a table. However, when I run the query through R, it returns…
Ray
  • 3,137
  • 8
  • 32
  • 59
4
votes
2 answers

How to skip primary key in sqlSave() command?

I am trying to insert a data.frame in the MySQL database using RODBC. The command I am using is the following: sqlSave(channel,dbData,tablename='table_name', append=TRUE,safer=TRUE,fast=FALSE,verbose=TRUE) Now the table in which I am trying to…
Sami
  • 153
  • 1
  • 1
  • 5
4
votes
1 answer

Improving RODBC-Postgres Write Performance

I've recently begun using RODBC to connect to PostgreSQL as I couldn't get RPostgreSQL to compile and run in Windows x64. I've found that read performance is similar between the two packages, but write performance is not. For example, using RODBC…
Jason B
  • 893
  • 7
  • 13
4
votes
2 answers

Connect R to Filemaker Pro 15 on Mac

I'm trying to create a connection between R (3.3.3) Using RStudio (1.0.143) and Filemaker Pro Advanced 15 (15.0.3.305). I'm trying to create the connection using RODBC (1.3-15). So far I: Created a toy FM Pro database for testing User id:…
Brad Cannell
  • 3,020
  • 2
  • 23
  • 39