I am working on a R shiny project where I need to read SQL tables from my Shiny application. I have tried using RODBC and RJDBC packages for the same and have found RJDBC to be faster. But it is still taking a lot of time to read.
Below is the code that I have used:
LocationOfJDBC <- "/usr/lib/sqlserver_jdbc/sqljdbc_4.1/enu/jre7/sqljdbc41.jar"
options(java.parameters = "-Xmx8048m")
drv <- JDBC("com.microsoft.sqlserver.jdbc.SQLServerDriver" , LocationOfJDBC ,identifier.quote="`")
df<-dbGetQuery(mydb, "Select char1,char2,char3,int4,date5 from table1")
This above query is taking around 90 sec to read 2.8 million rows and 5 columns (3 character, 1 int and 1 date column).
Is there a faster way to read SQL table in R??