horton.papa
horton.papa

Reputation: 1

Cryptic error when attempting the collect() function on a remote database in R

I am trying to run the code below and I got the error at the bottom:

prg3 <- 
+   prg2 %>% 
+   select(PGPRDC,
+          PGAGRP,
+          PGCAT1,
+          PGCAT2,
+          PGCAT3,
+          PGCAT4,
+          PGCDAT,
+          PGRFDT,
+          PGRTDT,
+          PGSUPP,
+          PGSHNO,
+          PGDESC,
+          PGSUPC,
+          PGRESP,
+          PGAPCO,
+          PGA6CO, #second avg cost?
+          PGASCO,
+          PGBCOS,
+          PGFCOS,
+          PGHNDV,
+          PGMULT,
+          PGBGAP,
+          everything()) %>% 
+   rename(prod_code = PGPRDC,
+          prod_acct_grp = PGAGRP,
+          cat1 = PGCAT1,
+          cat2 = PGCAT2,
+          cat3 = PGCAT3,
+          cat4 = PGCAT4,
+          prod_creation_date = PGCDAT,
+          prod_replace_from_date = PGRFDT,
+          prod_replace_to_date = PGRTDT,
+          supplier_number = PGSUPP,
+          prod_short_name = PGSHNO,
+          prod_desc = PGDESC,
+          supercede_yn = PGSUPC,
+          responible = PGRESP,
+          unit = PGUNIT,
+          vehicle_make = PGPGRP,
+          lot = PGBATC,
+          lead_time = PGLEAD,
+          structure_code = PGSTRC,
+          override_price_yn = PGOVDC,
+          backlog_code_yn = PGBALC,
+          avg_purch_cost = PGAPCO,
+          standard_cost = PGASCO,
+          base_cost = PGBCOS,
+          future_cost = PGFCOS,
+          handling_cost = PGHNDV,
+          prod_weight = PGWEIG,
+          car_line_ABC = PGABCC,
+          car_line_popularity = PGROPC,
+          company_wide_ABC = PGEOQC,
+          image_crit_core = PGSECT,
+          con_ctr_init_qty = PGPQTY,
+          pack_size = PGSIZE,
+          selling_increment = PGSINC,
+          avg_purch_cost2 = PGA6CO,
+          base_cost_multiplier = PGMULT,
+          avg_and_base_cost_gap = PGBGAP,
+          country_code = PGCOUN) %>%  collect()

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Timer-0"
Error in ._jobjRef_dollar(x[["jobj"]], name) : 
  no field, method or inner class called 'use_cli_format' 

The PRG_ objects are remote connections to a DB2 database with the following connection parameters:

driver <- JDBC("com.ibm.db2.jcc.DB2Driver", 
               "C:/Program Files/ibm/IBM DATA SERVER DRIVER/java/db2jcc4.jar")
               
password
conn <- dbConnect(driver, 
                  "jdbc:db2://wwtc.worldpac.com/S1013FCD", 
                  "username", 
                  "pw")

prg = tbl(conn, in_schema("ASDFLIB01", "SROPRG"))

I can us dplyr verbs to filter and such, but as soon as I collect() it throws that error.

I have R version 4.2.2 tidyverse 1.3.2 RJDBC 0.2-10 dbplyr 2.3.0

I have restarted my R session multiple times and I have updated the java version on my local machine. I am not sure how to proceed next?

Upvotes: 0

Views: 449

Answers (0)

Related Questions