agstudy / rsqlserver

Sql Server driver database interface (DBI) driver for R. This is a DBI-compliant Sql Server driver based on the System.Data.SqlClient.
82 stars 30 forks source link

can't use the package at all #21

Closed shrektan closed 9 years ago

shrektan commented 9 years ago

I tried several hours and failed to figure out the reason that I can't use your package. The dbGetInfo(conn)$State is 1, but I just can't execute any SQL. As long as I tried to execute any sql, the error occurs:

Error in sqlServerExecStatement(conn, statement, ...) : NA

my code

library(DBI)
library(rsqlserver)
url <- "Server=xx.xx.xx.xx;Database=abc;User Id=abc;Password=abc;"
conn <- dbConnect("SqlServer", url = url)

dbListFields(conn, "tablename")
Error in sqlServerExecStatement(conn, statement, ...) : NA

I can successfully do this dbGetInfo(conn)

$ClientConnectionId
[1] "85666cab-6210-4bc8-9cd3-e0530127941c"

$ConnectionString
[1] "Server=xxx.xxx.xxx.xx;Database=abc;User Id=abc;"

$ConnectionTimeout
[1] "15"

$Database
[1] "abc"

$DataSource
[1] "xx.xxx.xxx.xx"

$FireInfoMessageEventOnUserErrors
[1] "FALSE"

$PacketSize
[1] "8000"

$ServerVersion
[1] "12.00.2000"

$State
[1] "1"

$StatisticsEnabled
[1] "FALSE"

$WorkstationId
[1] "abcdefg"

If I tried to print the connection, it will show:

<SqlServerConnection>
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘dbIsValid’ for signature ‘"SqlServerConnection"’

my session info

R version 3.2.1 (2015-06-18)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936 
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936   
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C                                                   
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] rsqlserver_1.0 rClr_0.7-2    

loaded via a namespace (and not attached):
 [1] Rcpp_0.11.6     digest_0.6.8    R6_2.1.0        DBI_0.3.1.9008 
 [5] git2r_0.10.1    magrittr_1.5    httr_1.0.0      stringi_0.5-2  
 [9] curl_0.9        xml2_0.1.1      devtools_1.8.0  tools_3.2.1    
[13] stringr_1.0.0   rversions_1.0.1 memoise_0.2.1   knitr_1.10.5  

Can you please help me figure it out? thanks.

agstudy commented 9 years ago

Thank your for feedback. This is strange. I will take a closer look on this.

shrektan commented 9 years ago

This is really strange.

Can you suggest me to do something? I really want to try your package.... Thanks...

agstudy commented 9 years ago

This is fixed now. for more information you can see tests