args <- commandArgs(trailingOnly = TRUE)
id = as.character(args)
mysqlconnection = dbConnect(MySQL(), user = 'root', password = '', dbname = 'manu',host = 'localhost')
sql<-sprintf("select * from net where ips1=%s;",id)
up = dbGetQuery(mysqlconnection, sql)
I am trying to retrieve records from the table net using R. I want to retrieve the records with a specific id which is being passed as a command line argument.However i am getting an error near " ips1=%s ",saying that the SQL syntax which i used is incorrect. Any help?