search for: dbdisconnect

Displaying 20 results from an estimated 51 matches for "dbdisconnect".

2006 Mar 06
3
Disconnect all MySQL connections
Hi I've got the error "cannot allocate a new connection -- maximum of 16 connections already opened" after I tried to create a new connection to a database. However, the reason ist, that i did not disconnect previous connections.... I don't know the name of this connections. How can I disconnect this "unknown" connections and drivers? if I delete all objects, the
2009 Jan 13
0
crash on multiple queries to postgresql db [solved]
On Mon, Jan 12, 2009 at 6:31 PM, Martin Morgan <mtmorgan at fhcrc.org> wrote: > An off-list guess is, ironically, to NOT call dbDisconnect or gc(). > > The C code in the package registers a 'finalizer' that gets called when the > object is garbage collected. This is the same code that gets called by > dbDisconnect. Unfortunately, the code does not check to see if it's been > called already, so I think it'...
2010 Sep 08
1
on error execute:
So, i've been writing code in R interfacing with mysql, its been fun and the documentation has been useful, learning quite a bit. the only annoying thing i've been encountering is while coding/debugging, my session gets clogged, especially with sql connections. At the end of the code i dbDisconnect, but when the script is stopped by an error, the session stays open. Usually i'll remember to ls() and dbDisconnect at console manually, though, sometimes I forget and wind up with a bunch of extra connections. A couple of questions: First: is there a way to tell R to execute some comman...
2009 Mar 31
4
what is the preferred method to create a package local variable?
for the moment, I'm using: .onAttach <- function(libname, pkgname) { .bbg.db.conn <<- dbConnect(dbDriver("PostgreSQL"), user="blah","blah") } .onUnload <- function(libpath) { dbDisconnect(.bbg.db.conn) } which results in a hidden global variable in the global environment. I would prefer to make the assignment only in the package namespace. I've looked at assignInNamespace, but I can't seem to make it work. Is there a preferred method for doing this? When I try adding an...
2001 Mar 19
3
generic database access methods
...class # name, e.g., "PostgreSQL" or "MySQL". The implementation then # provides a method that actually opens the connection. # dbConnect.default <- function(dbObj, ...) stop("Invalid database class") # # User passed something other than a defined database class # dbDisconnect <- function(conn) UseMethod("dbDisconnect") # # Close connection and free resources # dbDisconnect.default <- function(conn) stop("Invalid connection object") dbReconnect <- function(conn) UseMethod("dbReconnect") # # The conn object should store the options...
2005 May 02
2
RMySQL query: why result takes so much memory in R ?
...and potential solutions. ## my code library(RMySQL) drv <- dbDriver("MySQL") ch <- dbConnect(drv,dbname="testdb", user="root",password="mysql") testdb <- dbGetQuery(ch, "select id, group, measurement from mydata") dbDisconnect(ch) dbUnloadDriver(drv) ## end of my code Cheers Christoph
2003 Feb 06
1
rdbi segmentation fault (fwd)
...t gives me a segmentation fault library(Rdbi) library(Rdbi.PgSQL) conn <- dbConnect(PgSQL(), dbname = "PGA") tmp <- "create table test ( expid int, name varchar(128));" result <- dbSendQuery(conn,tmp) dbClearResult(result) the last line can be substituted by dbDisconnect(conn) and you get a segmentation fault too. The database PGA does exist and the dbSendQuery does create a table (i checked via psql) i followed the instructions given by tim (see url or msg below) and im sending (what think is) the backtrace: Program received signal SIGSEGV, Segmentation fault....
2006 Mar 15
3
"\r" with RSQLite
...10 J > library(RSQLite) > drv <- dbDriver("SQLite") > con <- dbConnect(drv, dbname = "Test") > dbWriteTable(con, "DF", df, row.names = FALSE, overwrite = TRUE) [1] TRUE > df2 <- dbGetQuery(con, "SELECT DISTINCT * FROM DF") > dbDisconnect(con) [1] TRUE > df2 a b 1 1 A\r 2 2 B\r 3 3 C\r 4 4 D\r 5 5 E\r 6 6 F\r 7 7 G\r 8 8 H\r 9 9 I\r 10 10 J\r > sessionInfo() R version 2.2.1, 2005-12-20, i386-pc-mingw32 attached base packages: [1] "methods" "stats" "graphics" &quot...
2006 Mar 15
3
"\r" with RSQLite
...10 J > library(RSQLite) > drv <- dbDriver("SQLite") > con <- dbConnect(drv, dbname = "Test") > dbWriteTable(con, "DF", df, row.names = FALSE, overwrite = TRUE) [1] TRUE > df2 <- dbGetQuery(con, "SELECT DISTINCT * FROM DF") > dbDisconnect(con) [1] TRUE > df2 a b 1 1 A\r 2 2 B\r 3 3 C\r 4 4 D\r 5 5 E\r 6 6 F\r 7 7 G\r 8 8 H\r 9 9 I\r 10 10 J\r > sessionInfo() R version 2.2.1, 2005-12-20, i386-pc-mingw32 attached base packages: [1] "methods" "stats" "graphics" &quot...
2002 Apr 25
1
Rdbi package and PgSQL
I can use the Rdbi package to connect to a PostGreSQL server fine but when I use the dbDisconnect(), I get a segmentation error and it throws me out of R. I'm using RH7.2, R1.4.1, Rdbi 0.1-2, and Rdbi.PgSQL 0.1-2. Anyone else seen anything like this and have an possible answer? Andrew Schuh -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing...
2004 Feb 10
0
name space conflict using RMySQL and ROracle
...e, unloading and reloading the libraries is no solution... Example: ----------- snip ----------------- library(ROracle) library(RMySQL) mysql <- MySQL() con <- dbConnect(mysql, user=MySQL.name, password=MySQL.pwd, dbname=MySQL.DB, host=MySQL.host) MySQLres <- dbGetQuery(con, MySQL.query) dbDisconnect(con) ora <- Oracle() con <- dbConnect(ora, user=Oracle.name, password=Oracle.pwd, dbname=Oracle.DB) OraRes <- dbGetQuery(con, Ora.query) dbDisconnect(con) ----------- snap ----------------- platform sparc-sun-solaris2.8 arch sparc os solaris2.8 syst...
2010 Jan 26
1
[Fwd: Re: question on sqldf syntax]
...RMySQL) > library(sqldf) > sqldf("Select * from mtcars") Fehler in mysqlNewConnection(drv, ...) : RS-DBI driver: (Failed to connect to database: Error: Access denied for user 'user'@'localhost' (using password: NO) ) Fehler in if (dbname == ":memory:") dbDisconnect(connection) else if (!dbPreExists && : Argument hat L?nge 0 > detach("package:RMySQL") > sqldf("Select * from mtcars") mpg cyl disp hp drat wt qsec vs am gear carb 1 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 2 21.0 6 160.0 110 3.90 2.8...
2003 Feb 06
0
rdbi segmentation fault
...t gives me a segmentation fault library(Rdbi) library(Rdbi.PgSQL) conn <- dbConnect(PgSQL(), dbname = "PGA") tmp <- "create table test ( expid int, name varchar(128));" result <- dbSendQuery(conn,tmp) dbClearResult(result) the last line can be substituted by dbDisconnect(conn) and you get a segmentation fault too. The database PGA does exist and the dbSendQuery does create a table (i checked via psql) i followed the instructions given by tim (see url or msg below) and im sending (what think is) the backtrace: Program received signal SIGSEGV, Segmentation fault....
2012 Nov 06
1
how Can make function for selecting the products
...ot;) my.file.spes<-conv(my_file) myf<-rbind(myf,my.file.spes) } wd<-myf[order(myf$Product, myf$Time),] wd1<-wd[!duplicated(wd),] wd2<-as.data.frame(as.matrix(wd1),stringsAsFactors = FALSE) wd3<-transform(wd2, Price = as.numeric(Price), Volume = as.numeric(Volume)) dbDisconnect(con) return(wd3) } I want this program also work when I use wd3<-getdata(a,b,c,d,e,f,g,h...) for any length of my selection. How should I do this then? Thanks- Tammy [[alternative HTML version deleted]]
2003 Jan 24
1
RMySQL performance over RODBC
...ght as how to improve the speed with which RMySQL queries can be processed ? RMySQL database access is done as follows: ------------------------------------------- library(RMySQL) # 1 con <- dbConnect( ... ) # 2 ... rs <- dbSendQuery(con,qry) # 3 rdat <- fetch(rs,n=10000) # 4 ... dbDisconnect(con) # 5 ------------------------------------------- lines #3 and #4 are repeated about 10000 times in the script. Thanks in advance for any help. Sukhaswami Malladi *************************************************************************** The contents of this communication are intended...
2009 May 16
1
Fwd: Cannot allocate a new database connection error
...se for the particular subgroup * sub_group_where_condition <- fetch(dbSendQuery(myDbConnect(dbName,hostName), paste(c("SELECT where_clause FROM sub_grp where num=",sub_group_num_data[sub_group_num_loopcounter,1]),collapse="")), n = -1) * } dbDisconnect(con) dbListConnections(MySQL()) l<-list() } Where should i close the DB connection or use one single connection throughout the prograam. -- Thanks Moumita -- Thanks Moumita [[alternative HTML version deleted]]
2012 Jun 12
1
Not able to write to PostgreSQL database using "dbWriteTable"
...user = "xxxxx",password = "xxx") as.data.frame(zz[1]) dbGetQuery(connAE1,'SELECT id FROM \"test1\"') if(dbExistsTable(connAE1, "test1")){ dbWriteTable(con=connAE1,name='test1.id',value=as.data.frame(i),row.names=T ,overwrite=F ,append=T) } dbDisconnect(connAE1) dbUnloadDriver(drv1) ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Following is the past of the console Log for your Reference ++++++++++++++++++ console log ++++++++++++++++++++++++ > dbGetQuery(connAE1,'SELECT id FROM \"test1\"') id 1 1 2 2 > if(db...
2006 Nov 07
3
have I an actual matrix?
...t data from a MySQL database and plotting it with barplot. Here the code... library(RMySQL) con <- dbConnect(dbDriver ("MySQL"),host='localhost',username='root',dbname='ibdona') rs <- dbGetQuery (con,"select n,year from ibdona.library_location") dbDisconnect(con) Graph <- barplot(rs) And here the error I get... Error in barplot.default(rs) : 'height' must be a vector or a matrix paste(rs) gives me... [1] "c(307, 65, 2, 28, 3, 229, 81, 5, 7, 558, 134, 53, 9)" [2] "c(2002, 2002, 2002, 2002, 2002, 2003, 2003, 2003, 2003, 2004...
2003 Apr 24
1
RMySQL crash under R 1.7.0, but not 1.6.2
...XP with R 1.6.2 using: > library(DBI) > library(RMySQL) Warning message: DLL attempted to change FPU control word from 8001f to 9001f > drv <- dbDriver("MySQL") > con <- dbConnect(drv, dbname="zooscan") > dbExistsTable(con, "serie") [1] TRUE > dbDisconnect(con) [1] TRUE Notice the warning message, but apparently without other incidence. Now, when I try this with R 1.7.0, R crashes at the line: > con <- dbConnect(drv, dbname="zooscan") with the error report containing: AppName: rgui.exe AppVer: 1.70.30416.0 ModName: msvcrt.dll Mo...
2009 Dec 30
1
seg-fault... but on what
...],"','",fileLines[j,6],"','",fileLines[j,7],"')",sep="") #print(sql) atmpt <- try(dbGetQuery(con,sql)) options(show.error.messages = TRUE) if(inherits(atmpt, "try-error")){ } } } dbDisconnect(con) My understanding was that in general R liked to put a placekeeper like NA or NULL in for non-existent elements of defined structures... so I was surprised to see a seg fault... I'm having trouble interpretting the error... any clues would be appreciated. Nick [[alternative HTML version...