[R-sig-DB] Incorrect Error Status RODBC 1.2-3

McGehee, Robert Robert@McGehee @end|ng |rom geodec@p|t@|@com
Tue Jun 10 02:04:12 CEST 2008


Hello all,
I'm in the process of upgrading from RODBC 1.1-9 to 1.2-3 and have
discovered a problem in which RODBC will correctly run queries
containing CREATE and DROP but will incorrectly report an error status
of -1 resulting in an error in R (despite no actual error occurring). I
wanted to see if anyone has come across this before. Note that when I
run this script using RODBC 1.1-9 the queries run successfully without
returning a -1 error code.

> sqlQuery(.conn, "CREATE TABLE dbo.aaa (fun VARCHAR(255))", 
	     errors = FALSE)
[1] -1
> odbcGetErrMsg(.conn)
[1] "[RODBC] ERROR: Could not SQLExecDirect"

However, the table is created!

> sqlQuery(.conn, "INSERT INTO dbo.aaa SELECT 1")
character(0)

> sqlQuery(.conn, "SELECT * FROM dbo.aaa")
  fun
1   1

> sqlQuery(.conn, "DROP TABLE dbo.aaa", errors=FALSE)
[1] -1
odbcGetErrMsg(.conn)
[1] "[RODBC] ERROR: Could not SQLExecDirect"

Yet, the table has, in fact, been dropped!

Setup:
My database is Microsoft SQL Server 8.0 (SQL Server 2000). I'm running
RODBC on a Linux cluster tested on both 32-bit and 64-bit computers
running R 2.7.0. I'm using unixODBC 2.2.12 and FreeTDS 0.64 to interface
with the SQL server.

Any thoughts are appreciated!
Cheers, 
Robert

Robert McGehee, CFA
Geode Capital Management, LLC
One Post Office Square, 28th Floor | Boston, MA | 02109
Tel: 617/392-8396    Fax:617/476-6389
mailto:robert.mcgehee using geodecapital.com



This e-mail, and any attachments hereto, are intended fo...{{dropped:12}}




More information about the R-sig-DB mailing list