[R] Help ::Not able to Connect R to SQL Server 2000

Simon Urbanek simon.urbanek at r-project.org
Thu Aug 6 19:09:54 CEST 2009


On Aug 6, 2009, at 10:36 , bed.singh at oracle.com wrote:

> Hi Simon,
>
>   I am using the R 2.9.1 with Window XP.
>   I have one query related with R to the database. I have  
> successfully connected R to MS-Access.
>   But when I tried to connect R to SQL Server 2000 then it throwing  
> some class not found error.
>
>   I tried the below script for R and try to connect to SQL Server  
> 2000.
> > library(rJava)
> > library(DBI)
> > library(RJDBC)
> > drv<-JDBC("com.microsoft.jdbc.sqlserver.SQLServerDriver")
>   Error in .jfindClass(as.character(driverClass)[1]) : class not found
>
> Can you please help me in this? Thanks to you.
>

I suspect that you'll need to load the corresponding drivers. The  
message essentially tells you that the driver (class) you're trying to  
load is not known. I don't use Windows (and even less so SQL Server),  
so I'd suggest you search for JDBC and MS SQL Server and/or ask on the  
SIG-DB mailing list (although this is technically not an R question).  
With some luck there may be some MS SQL users on this list as well..

However, if you are on Windows, you may want to go directly to ODBC  
using RODBC instead of going through JDBC.

Cheers,
Simon




More information about the R-help mailing list