rdb2renamerjdbc

R -- RJDBC not able to rename column in SQL select


Using the RJDBC library seems like you can't rename the column in the SQL select. Anyone know a workaround for it? I found this useJDBC4ColumnNameAndLabelSemantics=true for Db2, but not sure it can use it in R.

Select
a.customer,
b.customer as main_customer,  <-- returns as customer not main_customer
b.customer_email
from customer a,
     main_customer b
where a.customer_id = b.customer_id

Solution

  • Found this -> Column alias querying IBM DB2 using Oracle SQL developer

    For example, in my case the database name is SAMPLE and if I want the application to show the correlation-ID names from my queries then I use for the database-name:

    SAMPLE:useJDBC4ColumnNameAndLabelSemantics=No;