[R] RODBC, freetds, and MS SQL Server

Andrew Schuh andys at neptuneinc.org
Tue Apr 1 02:12:35 CEST 2003

I have a question for RODBC users out there.  I have used the package with 
good results for some time.  However, I have just switched from an OpenLink 
proprietary driver for MS SQL to the FreeTDS driver (I think it is MS SQL 
Server 2000 I'm connecting to if it matters).  I was/am running them from 
unixODBC on a Linux Client.  I think I have it set up fine since I can use 
"isql" to perform simple queries on the database.  However, I get really odd 
behavior when I try to use it through RODBC.  It seems to connect fine but 
gives back odd results.  The database I'm accessing is called "cmp" and there 
are many tables of which one is called "Medium".  In the past "select * from 
cmp.Medium" has returned the whole table to me but now it only seems like I 
get column headers.  Any help or advice would be appreciated.

> library(RODBC)
> con <- odbcConnect("BIGSKY","***","**********")
> con
RODB Connection 0
> sqlTables(con)
[5] REMARKS        
<0 rows> (or 0-length row.names)
> sqlQuery(con,"select * from Medium")
[1] "[RODBC] ERROR: Could not SQLExecute"                                                                  
[2] "S1000 1 [unixODBC] Msg 208, Level 16, State 1, Server BIGSKY, Line 
1\nInvalid object name 'Medium'.\n"
> sqlQuery(con,"select * from cmp.Medium")
[1] MediumKey Medium    IsSpecies
<0 rows> (or 0-length row.names)
> version
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu        
system   i686, linux-gnu
major    1
minor    6.2
year     2003             
month    01               
day      10               
language R                

Also, I'm using the latest RODBC I got from CRAN yesterday.


Andrew Schuh
Environmental Mathematician
Neptune and Co.
(970) 223-7265
andys at neptuneinc.org

More information about the R-help mailing list