Simon Holgate
2004-Dec-09 13:06 UTC
[R] ROracle/DBI problem with dbExecStatement on RH Linux
Hi, first thanks to Sunny Ho (and David James for the pointer) for resolving the problem of the empty rows returned from ROracle. However, I have a problem still: > library(ROracle) > ora <- 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
Hi Simon, I believe you are not using the right syntax for dbExecStatement(). In particular, you should first use dbPrepareStatement, then dbExecStatement to execute a "prepared" statement. You may do a "? dbExecStatement" to read their usage. After some experimenting, I found that using dbSendQuery is much easier for the 'select' operation (the name 'Query' may imply that it is written just for the purpose of 'select'). For other operations (insert & delete, etc), then dbPrepareStatement & dbExecStatement could be more appropriate. My 2 cents, it is worth the effort to read the ROracle.pdf that comes with the ROracle package. Sunny Ho (sunny.ho at gmail.com)> > Date: Thu, 09 Dec 2004 13:06:52 +0000 > From: Simon Holgate <simonh at pol.ac.uk> > Subject: [R] ROracle/DBI problem with dbExecStatement on RH Linux > To: r-help at stat.math.ethz.ch > Message-ID: <41B84DEC.3090902 at pol.ac.uk> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hi, > > first thanks to Sunny Ho (and David James for the pointer) for resolving > the problem of the empty rows returned from ROracle. > > However, I have a problem still: > > > library(ROracle) > > ora <- 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 >