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
15
votes
4 answers

String continuation across multiple lines, no newline characters

Am using the RODBC library to bring data into R. I have a long query that I want to pass a variable to, much like this SO user. Problem is that R interprets the whitespace/carriage returns in my query as a newline '\n'. The accepted solution for…
Andrew
  • 9,090
  • 8
  • 46
  • 59
13
votes
1 answer

sqlSave: Mapping dataframe timestamps to SQL Server timestamps

I am trying to upload a data frame to a table in sql server using sqlSave(). This dataframe has a timestamp in it and I'd like to map the timestamp col to a datetime col in sqlserver. I am getting two problems. 1. It maps the data frame's timestamp…
Angelo
  • 2,936
  • 5
  • 29
  • 44
11
votes
4 answers

RODBC fails: "invalid character value for cast specification" - Excel 2007

I'm trying to use RODBC to write to an Excel2007 file and I keep getting errors. I've reduced the issue to this very basic case, a 1-row data.frame with character, numeric, Date, and logical datatypes: toWrite = data.frame( Name = "joe" , Date =…
Suraj
  • 35,905
  • 47
  • 139
  • 250
11
votes
3 answers

Save R plot to web server

I'm trying to create a procedure which extracts data from a MySQL server (using the RODBC package), performs some statistical routines on that data in R, then saves generated plots back to the server such that they can be retrieved in a Web Browser…
stotastic
  • 796
  • 1
  • 5
  • 18
11
votes
6 answers

How to convert searchTwitter results (from library(twitteR)) into a data.frame?

I am working on saving twitter search results into a database (SQL Server) and am getting an error when I pull the search results from twitteR. If I execute: library(twitteR) puppy <- as.data.frame(searchTwitter("puppy",…
analyticsPierce
  • 2,979
  • 9
  • 57
  • 81
11
votes
4 answers

Installation of RODBC on OS X Yosemite

When installing the R package RODBC in RStudio on OS X Yosemite, I get the following error: configure: error: "ODBC headers sql.h and sqlext.h not found" This is a common error and indicates that ODBC drivers haven't been installed (iODBC headers…
Carl
  • 1,346
  • 15
  • 35
11
votes
5 answers

ODBC works fine in MS Excel, but not in R

I've set up my ODBC driver so that MS Excel can import the data into a spreadsheet just fine. However, when I try to establish the connection with R, using ch <- odbcConnect(leprosyDHISdb, uid = leprosyDHISid, pwd = leprosyDHISpw) Then I get the…
Tom
  • 4,860
  • 7
  • 43
  • 55
11
votes
2 answers

Why am I getting warnings about closing unused RODBC handles?

I use RODBC with R and knitr to do some reporting using various production databases. In some of these reports I'm running multiplie queries against multiple databases. Each of my queries is carried out in a function of the form: get.total.orders <-…
mac
  • 3,137
  • 1
  • 28
  • 42
11
votes
3 answers

character(0) return when using RODBC

I am trying to import some data directly into R from a SQL Database. I have set up the connection without an issue but extracting the data has been somewhat challenging. I will try and make this as clear as possible because I don't think I can make…
Harrison Jones
  • 2,256
  • 5
  • 27
  • 34
10
votes
6 answers

RODBC sqlSave table creation problems

I'm having trouble creating a table using RODBC's sqlSave (or, more accurately, writing data to the created table). This is different than the existing sqlSave question/answers, as the problems they were experiencing were different, I can create…
Hack-R
  • 22,422
  • 14
  • 75
  • 131
10
votes
1 answer

Load, detach, re-load anomaly

I'm attaching, detaching, and re-attaching RODBC and data.table. When I perform this process with these packages in this order, I get the following error: Error : .onLoad failed in loadNamespace() for 'data.table', details: call: address(x) …
Matthew Plourde
  • 43,932
  • 7
  • 96
  • 113
10
votes
1 answer

Parameterized queries with RODBC

I have a variable in R that I would like to pass to a database. I could use paste like many suggest when reading Google results, but that is unsafe because of SQL injection vulnerabilities. I'd rather prefer something like this: x <- 42 sqlQuery(db,…
user142019
9
votes
6 answers

Problems with RODBC sqlSave

I'm having some difficulty inserting a data frame into a mySql database using RODBC. Below is the code I'm using: data <- data.frame(analysedDataID=c(1,2,3), plateWell=c("a","b","c"), screenPlateOrder=c(1,2,3), wellData=c("A","B","C")) con <-…
hberven1
  • 91
  • 1
  • 1
  • 2
9
votes
2 answers

RODBC and Microsoft SQL Server: Truncating Long Character Strings

I am trying to query a variable from a Microsoft SQL Server database using R/RODBC. RODBC is truncating the character string at 8000 characters. Original code: truncates at 255 characters (as per RODBC documentation) library(RODBC) con_string <-…
Chris
  • 3,401
  • 5
  • 33
  • 42
9
votes
2 answers

RODBC Query Tuning

I am trying to pull data from our Oracle datamart into R using RODBC. I have been able to work through some of my issues, but I have one basic question. How can I retain the formatting as it sits in the database? Using the following command uapp <-…
Btibert3
  • 38,798
  • 44
  • 129
  • 168
1
2
3
53 54