ripley at stats.ox.ac.uk
2007-Jul-26 16:29 UTC
[Rd] (PR#9810) Problem with careless user of RODBC (was SQL
Your error message was>> d <- sqlFetch(channel, District) > Error in odbcTableExists(channel, sqtable) : > object "District" not foundand as you had not defined an object 'District' in that session, it seems perfectly plain. If you want to refer to table "District" you have to give a character string (with quotes), not the name of an R object. If all else fails, READ the documentation! ?sqlFetch says sqtable: a database table name accessible from the connected dsn. This should be either a character string or a character vector of length 1. I am glad you love R, but it _would_ be nice to get some credit for the package that you are using without apparently being aware that it is contributed work, instead of being inconvenienced clearing up after a non-bug report. On Thu, 26 Jul 2007, jeff.lindon at thelearninginstitute.net wrote:> Full_Name: Jeff Lindon > Version: 2.5.0 > OS: mingw32 > Submission from: (NULL) (63.147.8.67) > > > R 2.5.0 seems to be unable to read valid tables from SQL Server 2005 with > Service Pack 2 installed: > >> version > _ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 2 > minor 5.0 > year 2007 > month 04 > day 23 > svn rev 41293 > language R > version.string R version 2.5.0 (2007-04-23) >> library(RODBC) >> channel <- odbcConnect("TLIAS01", uid="jeff.lindon") >> channel > RODB Connection 1 > Details: > case=nochange > DSN=TLIAS01 > UID=jeff.lindon > Trusted_Connection=Yes > WSID=TLIJLINDON > DATABASE=tliresearch >> d <- sqlFetch(channel, District) > Error in odbcTableExists(channel, sqtable) : > object "District" not found > > I have checked this problem with our CIO and he confirmed my Data Source > configuration is correct (the connection test confirmed that R is able to > connect to the database), and that the table really does exist and I have > correct permissions (I work with it daily). Moreover, I was working between R > and SQL Server 2005 with no problems before yesterday using the same exact set > of instructions. The only change our CIO and I could think of is the recent > installation of Service Pack 2. > > Unfortunately, reverting to Service Pack 1 is not currently an option, so I > cannot be sure this is the problem. I am able to work around the issue by > cutting and pasting the tables I need from SQL to Excel, then saving them as > csv's. Saving directly from SQL to csv (highlighting the desired output and > right-clicking) also causes problems for read.csv. I never tried that before > Service Pack 2, though. > > I hope this information helps. I absolutely love R and thank you all so much for > your work on it! > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595