search for: dbsendquery

Displaying 20 results from an estimated 99 matches for "dbsendquery".

2013 Jul 15
2
Serialize data.frame to database
Dear R-Users, I need a very fast and reliable database solution so I try to serialize a data.frame (to binary data) and to store this data to an SQLite database. This is what I tried to do: library(RSQLite) con <- dbDriver("SQLite") db <- dbConnect(con, "test") dbSendQuery(db, 'CREATE TABLE frames("simID" INT, "data" BLOB)') data.bin <- serialize(iris, NULL, ascii = FALSE) dbSendQuery(db, paste("INSERT INTO frames VALUES(1, X'", data.bin, "')", sep = "")) data.bin2 <- dbGetQuery(db, "SELECT...
2010 May 10
3
dbSendQuery with R variables
Rhelpers: I'd like to modify this RSQLite statement: rs_stations<-dbSendQuery(con_stations, "select * from stations") so that stations is actually an R variable, e.g.: stations=c("stationA","stationB") How would I modify the above statement to query from stations[[1]] (aka "stationA")? --j
2009 May 06
2
rmysql query help
...te format in a mysql table is pretty standard Any ideas? Thanks, Aaron require(RMySQL) startdatetime<-"2009-04-04 01:00:00" connect <- dbConnect(MySQL(),user="xxxxx",password="xxxxxx",dbname="xxxxx",host="xxx.xxx.xxx.xxx") forecast <- dbSendQuery(connect, statement=paste("SELECT ICE FROM table1 WHERE BEGTIME >= 'startdatetime'")) # doesnt read variable or forecast <- dbSendQuery(connect, statement=paste("SELECT ICE FROM table1 WHERE BEGTIME >="startdatetime)) # space error but this seems to work for...
2009 Jan 10
0
RMySQL CREATE TABLE error
...ipant = '005_avg' AND roi = '1033' AND timeseries_run = '2';") 8 > temp3 <- paste("CREATE TEMPORARY TABLE MyTemporaryTable3 SELECT * FROM tvalFDR_small WHERE participant = '005_avg' AND roi = '1033' AND nogestureFDR > 1.95;") 9 > dbSendQuery(con, temp1) <MySQLResult:(436,20,1)> 10 > dbSendQuery(con, temp2) <MySQLResult:(436,20,2)> 11 > dbSendQuery(con, temp3) <MySQLResult:(436,20,3)> 12 > query.string1 <- paste("SELECT t.timeseries_id, t.timeseries_signal FROM MyTemporaryTable1 t, MyTemporaryTable3 v...
2006 Nov 17
2
Forming SQL Query at run-time
Hi. I am trying to get data from mysql database using a couple of queries. I do one query to find out the indexes. Then i need to use these indexes in another query, but i keep getting errors. Here is something: numb <- dbSendQuery(con2, "select distinct(comparison) from table1") count <- fetch(numb, -1) my.matrix <- as.matrix(count) rs <- dbSendQuery(con2, "select A.comparison,A.id, A.q_value, B.q_value from table1 as A, table1 as B where A.comparison = 'my.matrix[11481]' AND B.comparison =...
2009 Jun 04
2
RPostgreSQL segfault with LEFT JOIN
...n_id ~~ '%SJER%' ORDER BY deb_lab_data.pedon_id, deb_lab_data.top ASC " # create an PostgreSQL instance and create one connection. drv <- dbDriver("PostgreSQL") conn <- dbConnect(drv, host="localhost", dbname="XXX", user="XXX") query <- dbSendQuery(conn, q) x <- fetch(query, n = -1) # extract all rows ---------------------------------------------------------------------------------------------------- Here is the error message in R: ---------------------------------------------------------------------------------------------------- row num...
2001 Mar 19
3
generic database access methods
..."dbConnectionOK") # # Returns TRUE if the connection object is valid and the connection # can be used to communicate with the database backend. # dbConnectionOK.default <- function(conn) FALSE # # User passed something other than a defined connection class # # # Rdbi: ioMethods.R # dbSendQuery <- function(conn, ...) UseMethod("dbSendQuery") # # This function submits a query string to the backend. If the query # generates any results, they should be returned in a data frame; # otherwise the function returns NULL. Printing error messgages is # left to the implementation, but...
2002 Dec 01
1
Date: Sun, 1 Dec 2002 13:23:04 -0600
...QL library. I've been attempting to create a temporary table in a MySQL database and then perform a SELECT with a WHEREs clause on the table. In effect perform a SELECT with a subSELECT. The problem is that it never seems to be able to find the table after I create it. I've been using the dbSendQuery method to create the table since this seems to be the one too use for sending all forms of SQL commands. Is it possible that MySQL is dropping the temporary table every time a new dbSendQuery is run? Or (more likely) am I using the library improperly. Thanks, James ... asset pricing is paradoxi...
2017 Jul 17
0
dbplyr error updating database
I am trying to use a shiny app to update records in an sqlite database. I keep running into the following error: unable to find an inherited method for function 'dbSendQuery' for signature '"src_dbi", "character"' The query I am trying to send is: [1] "update kpquestions set mrisupercat = 'Demographics - Respondent' , set mricategory = 'Respondent - Age' , where VariableNumber = 2;" Then I get this in my conso...
2008 Sep 25
1
Saving R-objects to a database
Someone solved the problem of saving R-objects to a database? These are the two varaints I've tried so far without success: 1) ser = rawToChar(serialize(obj, NULL, ascii=TRUE)) dbSendQuery(link, paste("insert into table values(1, '",ser,"')",sep='')) The field to save the object in the MySQL Database is of type text. unser = dbGetQuery(link,"select * from table where id=1") Warning message: In mysqlFetch(res, n, ...) : RS-DBI driver...
2018 Mar 02
3
Problemas de conexion con base de datso
...std::bad_alloc No entiendo muy bien porque me salta ese error, ya que desde SQL si que puedo acceder a dicha tabla... La base de datos ahora mismo esta casi vacia...(2 registros como mucho) Lo que hago para ver el codigo de la tabla es pinchar en View de Rstudio, pero haciendo l aconsulta con dbSendQuery(conexion,"SELECT * FROM Tabla1;") tb me da el mismo error. ?Qu? puede estar pasando? Gracias!! Jes?s [[alternative HTML version deleted]]
2011 Jan 04
2
Print plot to pdf, jpg or any other format when using scatter3d error
...) library(scatterplot3d) library(Rcmdr) ############################################################################## #database connection mycon <- dbConnect(MySQL(), user='root',dbname='test',host='localhost',password='') #distinct sessions rsSessionsU01 <- dbSendQuery(mycon, "select distinct sessionID from actiontimes where userID = 'ID01'") sessionU01 <-fetch(rsSessionsU01) sessionU01[2,] #user01 data mycon <- dbConnect(MySQL(), user='root',dbname='test',host='localhost',password='') rsUser01 <- dbSe...
2009 May 16
1
Fwd: Cannot allocate a new database connection error
...R-prompt and then run the script. *Error in mysqlNewConnection(drv, ...) : RS-DBI driver: (ì8@`qE@° ° cannot allocate a new connection -- maximum of 16 connections already opened) Error in is(object, Cl) : error in evaluating the argument 'conn' in selecting a method for function 'dbSendQuery' Error in is(object, Cl) : error in evaluating the argument 'res' in selecting a method for function 'fetch'* *this is my DB connection function* *myDbConnect <- function (dbName, hostName) { drv<-MySQL() con <- dbConnect(drv, user="xyz", passw...
2003 Jul 15
1
dbApply (R newbee)
...should calculate the 85% quantile of AvgSpeed for each LinieID. Looking through documentation of the RMySQL Package, I guessed that dbApply would do the trick due to this example ## compute quanitiles for each network agent con <- dbConnect(MySQL(), group="vitalAnalysis") res <- dbSendQuery(con, "select Agent, ip_addr, DATA from pseudo_data order by Agent") out <- dbApply(res, INDEX = "Agent", FUN = function(x, grp) quantile(x$DATA, names=FALSE)) But when I try I get this: > con = dbConnect(MySQL(),group="Speed") >...
2007 Dec 10
7
Sweave : change value in rnw file to generate multiple "single" reports ?
Hello, I'm still trying to make the life of my colleagues easier. Nice, isn't it ? At the moment, I'm looking for a way to generate multiple "single report". In fact I have a .rnw file which send a query to a MySQL database (rs<-dbSendQuery(con, statement="select * from treatdata where name='Device1'") But of course my colleagues have many devices and don't want to enter the rnw file to change the name of the device. Is there a way to pass arguments to Sweave like Sweave("myfile.rnw", namevar="De...
2007 Jun 05
1
multiple plot in odfWeave
...drv <- dbDriver("MySQL") con <- dbConnect(drv, user="lamilhat", password="******", dbname="Aquagenome", host="mymachine.toulouse.inra.fr") @ Liste des projets: <<carte2, echo = FALSE, results= verbatim, fig = TRUE>>= lp <- dbSendQuery(con, "SELECT nom FROM projets") projets <- fetch(lp) nbr=dim(projets)[1] for (i in 1:nbr) { monprojet=(projets)[i,1] myquery=paste("SELECT s.longitude, s.latitude, o.orgashort FROM organisme o JOIN scientist s ON o.codeorga=s.codeorga JOIN partenaire p ON p.codescientist...
2004 Dec 09
1
ROracle/DBI problem with dbExecStatement on RH Linux
...dbDriver("Oracle") > con <- dbConnect(ora, user = USER, password = PWD, dbname = DBNAME) > rs <- dbExecStatement(con, "select * from USER_TABLES") Error in .class1(object) : No direct or inherited method for function "dbExecStatement" for this call dbSendQuery/dbGetQuery work fine. I've reinstalled ROracle 0.5-5 and DBI 0.1-8 from source on RH Linux Enterprise WS release 3 Taroon update; kernel 2.4.21-9.0.1; Oracle 9.2.0.1; R 1.9.1. Any suggestions on resolving this would be much appreciated. Cheers, Simon
2010 Sep 22
1
agregar valores a una tablea de SQL
...L, y a la vez con bases SQL, así que a lo mejor no es tan complicado. Quiero agregar valores, que genero en R, a una tabla de SQL más o menos la idea es: > ssql<-"INSERT INTO tabla1 (variableA, variableB) VALUES (''valor1'',''valor2'')" > dbSendQuery(conec, ssql) pero entonces se incertan ceros en tabla1, siendo que valor1 y valor2, son las variables que me guardan el numerito que generé en R... cómo le hago para que SQL así lo entienda?? Muchas gracias [[alternative HTML version deleted]]
2014 Oct 20
0
dbHasCompleted() always returns TRUE for POSTGRES Database with RJDBC?
...else have or had this problem? All the best Julian ######## adapted Example from help (?dbHasCompleted ), Works ####### require("RSQLite") con <- dbConnect(RSQLite::SQLite(), ":memory:") dbWriteTable(con, "mtcars", mtcars) # Fetch all results res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4") dbFetch(res) dbClearResult(res) # Fetch in chunks res <- dbSendQuery(con, "SELECT * FROM mtcars") dbHasCompleted(res) ## RETURNS FALSE !!! while (!dbHasCompleted(res)) { chunk <- fetch(res, 10) print(nrow(chunk)) } dbClear...
2005 Apr 02
2
RMySQL question
Dear List, I have this little problem: I work with adiacency matrix like: data me you me 0 1 you 1 0 I store those matrix in a mysql database actually I use RMySQL with: res<-dbSendQuery(connection, "SELECT * FROM table") myDataFrame<-fetch(res) to retrive the table, and I have data me you 1 io 0 1 2 tu 1 0 I would like the first column to be seen not as data, but as label, like: data me you io 0 1 tu 1 0 should I change...