I have learned the hard way it is important to be aware that

Type-handling is a rather complex issue, especially with JDBC as different databases support different data types. RJDBC attempts to simplify this issue by internally converting all data types to either character or numeric values.


This because RODBC does not have the same behaviour.

When switching a few R scripts over from using RJDBC to access a MS SQL Server database to RODBC, I ran into some odd problems.

First, I noticed as.Date(query,output$datecolumn) resulted in what looked like 2016-06-21 becoming 2016-06-22. That's right, R started adding a day to the date. as.Date(strptime(query.output$datecolumn, "%Y-%m-%d")) put a stop to that madness.

Another problem had to do with an XML value being returned by a query. The application generating that XML for some reason opts to not store it as an XML data type but instead uses a varchar. That makes it is very hard to use XQuery, so I had opted to do the hard work in R by taking the whole XML value into R - despite this making the retrieval of query results almost impossible. In order to convert that column to an XML data type in R, I was able to do sapply(response.xml$response, xmlParse) on the output of a SQL query using RJDBC. Once the output from the RODBC connection had to be processed, this needed to become sapply(response.xml$response, xmlParse, asText = TRUE). It is interesting this wasn't needed for the RJDBC output.

So yes, type-handling is a rather complex issue.