[R] RODBC, freetds, and MS SQL Server

Andrew Schuh andys at neptuneinc.org
Tue Apr 1 20:42:21 CEST 2003


I'm happy.  Setting this argument seemed to work for me and I guess I 
should have messed with it a bit.  I guess the argument seemed a bit 
confusing and didn't seem to imply to me that it represented a possible 
solution.  However, it does seem to work with the MS SQL Server I'm 
having to use.  I haven't been connected to the list since last November 
so I'm sorry if I missed some discussion on this.  It might be a good 
idea to call it out a bit more in the details and state that it has 
represented a potential solution with Oracle and MS SQL Server.  Also, 
for those out there that are looking for a good way to connect R to a MS 
SQL Server; installing freetds via unixODBC seems to work (fingers 
crossed).  Thanks again.

Prof. Brian Ripley wrote:

>?odbcConnect has
>
>believeNRows: logical.  Is the number of rows returned by the ODBC
>          connection believable?  Not true for Oracle, apparently.
>
>Try setting it to FALSE, as it looks like your driver is broken.
>
>I am not wure why people keep ignoring this parameter in RODBC ....
>
>
>On Mon, 31 Mar 2003, Andrew Schuh wrote:
>
>  
>
>>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
>>Details:
>>  case=nochange
>>  0À¨¦àÒ¨¦àÒ× 
>>    
>>
>>>sqlTables(con)
>>>      
>>>
>>[1] TABLE_QUALIFIER TABLE_OWNER     TABLE_NAME      TABLE_TYPE     
>>[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
>>status                    
>>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.
>>
>>
>>    
>>
>
>  
>



More information about the R-help mailing list