[datatable-help] why querying Sybase IQ using RODBC returns error

Alok Jadhav alok.jadhav at credit-suisse.com
Fri Jul 27 02:51:09 CEST 2012


Hello team,

 I am not able to query Sybase IQ database from R using RODBC package. 
Check the below code

R> sybaseiq.query <- function (sql, ..., as.is = FALSE)
{
  connstr <- "Driver={Sybase
IQ};UID=ajadhav2;PWD=*****;ServerName=PSGSESHR01A_IQ;CommLinks=SharedMemory,TCPIP{host=psgseshr01_iq.sg.csfb.com;port=3051}"
  chan <- odbcDriverConnect(connstr)
  on.exit(odbcClose(chan))
  if (length(list(...)) > 0)
    sql <- sprintf(sql, ...)
  x <- sqlQuery(chan, sql, as.is = as.is)
  return(x)
}
R>
R>
R>
R> x <- sybaseiq.query("select * from syagprd1.orders where
tradedate='120727' and acct='DVW'")
*Error in .Call(C_RODBCFetchRows, attr(channel, "handle_ptr"), max,
buffsize,  : 
  negative length vectors are not allowed*
R> x
[1] "42000 -131 [Sybase][ODBC Driver][Sybase IQ]Syntax error near 'order' on
line 1"                                                            
[2] "[RODBC] ERROR: Could not SQLExecDirect 'select * from syagprd1.order
where tradedate='120727' and acct='DVW' and ptag=-1 and sym='BHP.AX''"


This is true for empty datasets also

R> x <- agora.query.iq("select * from syagprd1.orders where 1=2")
Error in .Call(C_RODBCFetchRows, attr(channel, "handle_ptr"), max, buffsize, 
: 
  negative length vectors are not allowed

I am not sure what is wrong. Are their some arguments I need to know while I
create chan to resolve this issue?

Thanks for your help in advance.

Regards,
Alok



--
View this message in context: http://r.789695.n4.nabble.com/why-querying-Sybase-IQ-using-RODBC-returns-error-tp4638029.html
Sent from the datatable-help mailing list archive at Nabble.com.


More information about the datatable-help mailing list