Re: [R] R connection with sql server 2005
Hi all, Problem is solved. The solution is I needed to pass the whole string "driver=SQL Server;server= 01hd166373" as a parameter and not only the servername. my<-function(servername,dbname,dbtable){ library(RODBC) channel<- odbcDriverConnect(paste(servername) init_data<- sqlQuery(channel,paste("select * from",dbname,"..",dbtable) } my("driver=SQL Server;server= 01hd166373",test_db,test_vikrant) Cheers, Vikrant. -- View this message in context: http://n4.nabble.com/R-connection-with-sql-server-2005-tp1478145p1478484.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R connection with sql server 2005
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. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.