{"action":"created","issue":{"url":"https://api.github.com/repos/imanuelcostigan/RSQLServer/issues/26","labels_url":"https://api.github.com/repos/imanuelcostigan/RSQLServer/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/imanuelcostigan/RSQLServer/issues/26/comments","events_url":"https://api.github.com/repos/imanuelcostigan/RSQLServer/issues/26/events","html_url":"https://github.com/imanuelcostigan/RSQLServer/issues/26","id":88122214,"number":26,"title":"dbSendQuery expects result set, returns error although statement succeeds","user":{"login":"Hong-Revo","id":11328890,"avatar_url":"https://avatars.githubusercontent.com/u/11328890?v=3","gravatar_id":"","url":"https://api.github.com/users/Hong-Revo","html_url":"https://github.com/Hong-Revo","followers_url":"https://api.github.com/users/Hong-Revo/followers","following_url":"https://api.github.com/users/Hong-Revo/following{/other_user}","gists_url":"https://api.github.com/users/Hong-Revo/gists{/gist_id}","starred_url":"https://api.github.com/users/Hong-Revo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hong-Revo/subscriptions","organizations_url":"https://api.github.com/users/Hong-Revo/orgs","repos_url":"https://api.github.com/users/Hong-Revo/repos","events_url":"https://api.github.com/users/Hong-Revo/events{/privacy}","received_events_url":"https://api.github.com/users/Hong-Revo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-14T05:01:23Z","updated_at":"2015-06-14T12:31:01Z","closed_at":null,"body":"It looks like `dbSendQuery` is expecting a result set, although per the DBI docs, it isn't supposed to. While the SQL executes on the database correctly, the function returns an error.\r\n\r\nHere's a minimal example where I create a schema and a table, insert values into it, and then read the table back into R.\r\n\r\n    con <- dbConnect(SQLServer(), ....)\r\n    dbSendQuery(con, \"create schema sc\")\r\n    dbSendQuery(con, \"create table sc.table1 (\r\n        n int,\r\n        x real\r\n    )\")\r\n    dbSendQuery(con, \"insert into sc.table1 values\r\n        (1, 2.5),\r\n        (2, 0.0),\r\n        (3, 3.14159)\r\n    \")\r\n    dbReadTable(con, \"sc.table1\")\r\n\r\nAll the `dbSendQuery` calls return errors like\r\n\r\n>Error in .verify.JDBC.result(r, \"Unable to retrieve JDBC result set for \",  : \r\n>  Unable to retrieve JDBC result set for create table sc.table1 (\r\n>    n int,\r\n>    x real\r\n>) (The executeQuery method must return a result set.)\r\n\r\nbut the final `dbReadTable` shows that the table was created anyway:\r\n\r\n      n       x\r\n    1 1 2.50000\r\n    2 2 0.00000\r\n    3 3 3.14159\r\n"},"comment":{"url":"https://api.github.com/repos/imanuelcostigan/RSQLServer/issues/comments/111822314","html_url":"https://github.com/imanuelcostigan/RSQLServer/issues/26#issuecomment-111822314","issue_url":"https://api.github.com/repos/imanuelcostigan/RSQLServer/issues/26","id":111822314,"user":{"login":"Hong-Revo","id":11328890,"avatar_url":"https://avatars.githubusercontent.com/u/11328890?v=3","gravatar_id":"","url":"https://api.github.com/users/Hong-Revo","html_url":"https://github.com/Hong-Revo","followers_url":"https://api.github.com/users/Hong-Revo/followers","following_url":"https://api.github.com/users/Hong-Revo/following{/other_user}","gists_url":"https://api.github.com/users/Hong-Revo/gists{/gist_id}","starred_url":"https://api.github.com/users/Hong-Revo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hong-Revo/subscriptions","organizations_url":"https://api.github.com/users/Hong-Revo/orgs","repos_url":"https://api.github.com/users/Hong-Revo/repos","events_url":"https://api.github.com/users/Hong-Revo/events{/privacy}","received_events_url":"https://api.github.com/users/Hong-Revo/received_events","type":"User","site_admin":false},"created_at":"2015-06-14T12:31:01Z","updated_at":"2015-06-14T12:31:01Z","body":"What I mean is that dbSendQuery isn't supposed to want a result set. This is from ?dbSendQuery:\r\n\r\n>The function dbSendQuery only submits and synchronously executes the SQL statement to the database engine. It does not extracts any records — for that you need to use the function dbFetch, and then you must call dbClearResult when you finish fetching the records you need."}}