[R] R connection with sql server 2005

vikrant vikrant.shimpi at tcs.com
Fri Feb 12 06:46:44 CET 2010


Dear  R experts,
I am using RODBC package. 
library(RODBC)
channel<- odbcDriverConnect("driver=SQL Server;server=",servername)
data<- sqlQuery(channel,"select * from dbname .. dbtable")
Here if i use this it is getting executed successfully.
But when i put this in a function as

 my<-function(servername,dbname,dbtable){
 	library(RODBC)
 	channel<- odbcDriverConnect(paste("driver=SQL Server;server=",servername))
 	init_data<- sqlQuery(channel,paste("select * from",dbname,"..",dbtable)
}
I get an error in a window  as connection failed and when I click ok i get
the window for login with list of server name. when i select the same server
name which i passed as parameter I am able to login.
Is there any error in the function ?


Thanks in advance
-- 
View this message in context: http://n4.nabble.com/R-connection-with-sql-server-2005-tp1478145p1478145.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list