Mark LoPresti
2012-Feb-06 20:02 UTC
[R] sqsSave() test using Test.R script returning error suggesting no values upon "insert"
Hi. I attempted to use RODBC and decided to execute all the tests provided in "Test.r" under the unpacked package RODBC folder. Beginning with the following: library(RODBC) library(MASS) USArrests[1,2] <- NA hills <- hills[1:15,] row.names(hills)[12] <- "Dollar ('$')" set.seed(1) # MySQL ## testdb3 is ODBC/Connector 3.51.x, testdb5 is 5.1.x channel <- odbcConnect("MysqlODBC") #my database odbcGetInfo(channel) sqlTypeInfo(channel) sqlTables(channel) sqlDrop(channel, "test.USArrests",errors = FALSE) #explicit database AND table call as MySQL doesn't allow general table creation Everything works as advertised. ----------------------------------------------------------------------------------------------- #Then we get here. I have the USArrests data and checked it but tried to save as it produced an error. sqlSave(channel, USArrests,"test.USArrests",rownames = "state", addPK = TRUE) "Error in odbcUpdate(channel, query, mydata, coldata[m, ], test = test, : no parameters, so nothing to update" The database table exists and upon edit of the table fields, all table info created correctly. Attempted again adding "verbose=TRUE":> sqlSave(channel, USArrests,"test.USArrests",rownames = "state", addPK = TRUE, verbose=TRUE)Query: CREATE TABLE test.usarrests (`state` varchar(255) NOT NULL PRIMARY KEY, `murder` double, `assault` integer, `urbanpop` integer, `rape` double) Query: INSERT INTO test.usarrests ( `` ) VALUES ( ?,?,?,?,? ) Error in odbcUpdate(channel, query, mydata, coldata[m, ], test = test, : no parameters, so nothing to update Does anyone know what is happening? For whatever reason it is not "seeing" or ingesting the data (BOLDED "Query:..". I've seen one other post that did not receive an answer (probably due to its lack of brevity). I'm using Window's Vista, R 2.11.1 Here's is my MySQL info:> odbcGetInfo(channel)DBMS_Name DBMS_Ver Driver_ODBC_Ver Data_Source_Name Driver_Name Driver_Ver "MySQL" "5.1.33-community" "03.51" "MysqlODBC" "myodbc5.dll" "05.01.0007" ODBC_Ver Server_Name "03.52.0000" "localhost via TCP/IP" Thank you for your time. Mark LoPresti [[alternative HTML version deleted]]