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 error still occurs. Exists a function which i don't know? Thanks a lot for your help. Regards Nik
mailto-nik at bluemail.ch wrote:> 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 error still occurs. > Exists a function which i don't know? > > Thanks a lot for your help. > Regards > Nik > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlWhich package are we talking about? RODBC has: odbcCloseAll() RMySQL has: dbListConnections() and dbDisconnect() And others have other methods, just read the corresponding manuals. Uwe Ligges
mailto-nik at bluemail.ch wrote:> 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 error still occurs. > Exists a function which i don't know?You can use dbDisconnect() together with dbListConnections() to disconnect those connections RMySQL is managing: > all_cons <- dbListConnections(MySQL()) > for(con in cons) + dbDisconnect(con) ## check all connections have been closed > dbListConnections(MySQL()) > list() You could also kill any connection you're allowed to (not just those managed by RMySQL): > dbGetQuery(con, "show processlist") Id User Host db Command Time 1 2366 celnet_do gaia:47944 wireless Connect 19 2 2367 celnet_do gaia:47946 wireless Connect 15 3 2368 celnet_do gaia:47948 wireless Query 0 > dbGetQuery(con, "kill 2366") > dbGetQuery(con, "kill 2367") .... HTH, -- David> > Thanks a lot for your help. > Regards > Nik > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Use the function dbListConnections() to get a list of connections. Then use dbDisconnect() to disconnect them one by one. Using Oracle as an example:> dbm <- Oracle() > dbDisconnect(dbListConnections(dbm)[[1]])[1] TRUE -Don At 3:18 PM +0100 3/6/06, mailto-nik at bluemail.ch wrote:>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 error still occurs. >Exists a function which i don't know? > >Thanks a lot for your help. >Regards >Nik > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA