How to capture JDBC Connection parameter LOG=DEBUG messages with R

The best minds from Teradata, our partners, and customers blog about whatever takes their fancy.
Teradata Employee

JDBC Connection parameter LOG=DEBUG prints error, timing, informational, and debug messages to Java System.out. The following shows how the messages can be captured with R.

R can be started with several executables: R, Rgui, Rscript, Rterm. Not all of them capture messages printed to Java System.out, e.g. Rgui version 2.15.3 on Windows. Rscript does not include the invoked R commands in its output, so the executables to use for capturing invoked R commands and messages printed to Java System.out are R or Rterm.

  1. Save the following in a file, e.g. Rtest.txt.

    drv = JDBC("com.teradata.jdbc.TeraDriver","c:\terajdbc\terajdbc4.jar;c:\terajdbc\tdgssconfig.jar")
    con = dbConnect(drv,"jdbc:teradata://system/LOG=DEBUG","user","password")
    dbGetQuery(con,"select * from dbc.dbcinfo")

  2. Enter the following to execute Rterm and save the output in Result.log: Rterm --no-save < Rtest.txt > Result.log