rodbc

RODBC and Microsoft SQL Server: Truncating Long Character Strings

左心房为你撑大大i 提交于 2019-12-08 19:39:50
问题 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 <- odbcConnect("DSN") query_string <- "SELECT text_var FROM table_name" dat <- sqlQuery(con_string, query_string, stringsAsFactors=FALSE) Partial solution: modifying query string truncate text after 7999 characters. library(RODBC) con_string <-

how to install RODBC on macOS Sierra 10.12.4

僤鯓⒐⒋嵵緔 提交于 2019-12-08 18:32:28
In R 3.4.0, install.packages('RODBC', type='source') fails on macOS 10.12.4. I also downloaded RODBC_1.3-15.tar.gz from CRAN and tried, R CMD INSTALL RODBC_1.3-15.tar.gz In both cases, I got "ODBC headers sql.h and sqlext.h not found". A discussion of this in Installation of RODBC/ROracle packages on OS X Mavericks says the following: To fix this, you need to download the latest version of iODBC (www.iodbc.org), and then unzip the file and set your header and library search paths to the location where you put the unzipped package. If you don't know how to set your search paths, you could just

Connecting R To Teradata VOLATILE TABLE

落爺英雄遲暮 提交于 2019-12-08 10:02:57
问题 I am using R to try and connect to a teradata database and am running into difficulties The steps in the process are below 1) Create Connection 2) Create a VOLATILE TABLE 3) Load information from a data frame into the Volatile table Here is where it fails, giving me an error message Error in sqlSave(conn, mydata, tablename = "TEMP", rownames = FALSE, : first argument is not an open RODBC channel The code is below # Import Data From Text File and remove duplicates mydata = read.table("Keys.txt

Import Data from SQL Server To shiny app

删除回忆录丶 提交于 2019-12-08 04:13:06
问题 i worked on data from SQL Server in R using RODBC and after getting my result i created ShinyApp to deploy my result But i want to get my data from my SQL query directly without exporting my result to Excel and then import it to shiny,How can i do that? Test <- odbcDriverConnect("driver={SQL Server};server=localhost;database=Fakahany;trusted_connection=true") Orders<- sqlQuery(Test," SELECT WHWorkOrderHeaderId , OtherLangDescription FROM Warehouse.WHWorkOrderDetails INNER JOIN Warehouse

Parallel Database calls with RODBC

房东的猫 提交于 2019-12-08 03:56:49
问题 I am operating on chunks of panel data with about 3*10^6 rows and 11 columns. This data is stored in a SQL database (the data I use is a subset of an even larger dataset). I want to process chunks of the data (each date seperately) without importing the entire thing all at once, but the operations I have to run on each chunk are computationally intensive, so I would like to use the foreach package. However, I am running into some problems with running the sql call in parallel. If I do a

Data from ODBC blob not matching return from SQL query

我怕爱的太早我们不能终老 提交于 2019-12-07 18:04:44
问题 I’m reading a BLOB field from an ODBC data connection (the BLOB field is a file). I connect and query the database, returning the blob and the filename. The blob itself does not contain the same data as I find in the database however. My code is as follows along with the data returned vs in the DB. library(RODBC) sqlret<-odbcConnect('ODBCConnection') qry<-'select content,Filename from document with(nolock) where documentid = \'xxxx\'' df<-sqlQuery(sqlret,qry) close(sqlret) rootpath<-paste0

RODBC connectivity to Oracle without tnsnames.ora

懵懂的女人 提交于 2019-12-07 12:55:07
问题 I am trying to connect to Oracle from R using RODBC without using tnsnanes.ora. I have tried following strings, but none of them are working. > con.text <- paste0("Driver={OracleODBC-11g};Dbq=//oracle.server:1527/database.pdw.prod;Uid=user;Pwd=pswd;") > con.text <- paste0("Driver={OracleODBC-11g}; ", "CONNECTSTRING=(DESCRIPTION=(ADDRESS= (PROTOCOL = TCP)(HOST = oracle.server)(PORT = 1527))(CONNECT_DATA=(SERVICE_NAME = database.pdw.prod))); uid=user;pwd=pswd;") > con.text <- paste0("Driver=",

Import Data from SQL Server To shiny app

↘锁芯ラ 提交于 2019-12-07 06:02:25
i worked on data from SQL Server in R using RODBC and after getting my result i created ShinyApp to deploy my result But i want to get my data from my SQL query directly without exporting my result to Excel and then import it to shiny,How can i do that? Test <- odbcDriverConnect("driver={SQL Server};server=localhost;database=Fakahany;trusted_connection=true") Orders<- sqlQuery(Test," SELECT WHWorkOrderHeaderId , OtherLangDescription FROM Warehouse.WHWorkOrderDetails INNER JOIN Warehouse.WHWorkOrderHeader AS WHH ON Warehouse.WHWorkOrderDetails.WHWorkOrderHeaderId = WHH.ID INNER JOIN Warehouse

Unable to append to SQL Server table using sqlSave in R

若如初见. 提交于 2019-12-07 05:32:20
问题 I am trying to update a SQL table using sqlSave function of RODBC package in R. Data is present in a data frame. When I try to run the command: sqlSave(DBConn, dat=df, verbose=T, tablename='table', append=T) I get the following error: Query: INSERT INTO "table" ( "col1", "col2", "col3", "col4" ) VALUES ( ?,?,?,?,? ) sqlwrite returned 42000 -131 [Sybase][ODBC Driver][Sybase IQ]Syntax error near 'table' on line 1 [RODBC] ERROR: Could not SQLPrepare 'INSERT INTO "table" ( "col1", "col2", "col3",

Parallel Database calls with RODBC

血红的双手。 提交于 2019-12-07 02:57:31
I am operating on chunks of panel data with about 3*10^6 rows and 11 columns. This data is stored in a SQL database (the data I use is a subset of an even larger dataset). I want to process chunks of the data (each date seperately) without importing the entire thing all at once, but the operations I have to run on each chunk are computationally intensive, so I would like to use the foreach package. However, I am running into some problems with running the sql call in parallel. If I do a simple call such as ( sqlQuery(channel, "select 1") ) I can run that in parallel. If I do a more complex