Postgres output code error: pstmt_tPostgresqlOutput_1 cannot be resolved

Highlighted
Five Stars

Postgres output code error: pstmt_tPostgresqlOutput_1 cannot be resolved

I'm trying to read an excel file into a postgres database. I dont get any errors on the tFileInputExcel_1 element and i can acces the database to select the table.

However when i run the job i get: 

At least job "exlTransfer" has a compile errors, please fix and export again.
Error Line: 750Detail Message: pstmt_tPostgresqlOutput_1 cannot be resolved
There may be some other errors caused by JVM compatibility.
Make sure your JVM setup is similar to the studio. at org.talend.designer.runprocess.JobErrorsChecker.checkLastGenerationHasCompilationError(JobErrorsChecker.java:326) at org.talend.designer.runprocess.DefaultRunProcessService.checkLastGenerationHasCompilationError(DefaultRunProcessService.java:380)
.....

 

 When i look at the generated code i see the variable pstmt_tPostgresqlOutput_1 is use in method tFileInputExcel_1Process() in line 750 but it has not been declared anywhere prior to this use. In other words the generated code does not compile.

 

I have tried starting a new job and defining the excel to postgres import a-new but with the same result. The same error is reported here:https://stackoverflow.com/questions/43662405/talend-csv-file-to-postgres As far as JVM compatibility is concerned, i'm using java 8, Talend version 6.4.1. How can i resolve this? I dont even know what type the pstmt_tPostgresqlOutput variable should have.

 

public void tFileInputExcel_1Process(
			....

  if (row1 != null) {

        /**
         * [tPostgresqlOutput_1 main ] start
         */

        currentComponent = "tPostgresqlOutput_1";

        // row1
        // row1

        if (execStat) {
         runStat.updateStatOnConnection("row1"
           + iterateId, 1, 1);
        }

        whetherReject_tPostgresqlOutput_1 = false;

        pstmt_tPostgresqlOutput_1.addBatch();
        nb_line_tPostgresqlOutput_1++;

        batchSizeCounter_tPostgresqlOutput_1++;

        if ((batchSize_tPostgresqlOutput_1 > 0)
          && (batchSize_tPostgresqlOutput_1 <= batchSizeCounter_tPostgresqlOutput_1)) {
         try {
          int countSum_tPostgresqlOutput_1 = 0;

          for (int countEach_tPostgresqlOutput_1 : pstmt_tPostgresqlOutput_1
            .executeBatch()) {
           countSum_tPostgresqlOutput_1 += (countEach_tPostgresqlOutput_1 < 0 ? 0
             : countEach_tPostgresqlOutput_1);
          }

          insertedCount_tPostgresqlOutput_1 += countSum_tPostgresqlOutput_1;

          batchSizeCounter_tPostgresqlOutput_1 = 0;
         } catch (java.sql.BatchUpdateException e_tPostgresqlOutput_1) {
          java.sql.SQLException ne_tPostgresqlOutput_1 = e_tPostgresqlOutput_1
            .getNextException(), sqle_tPostgresqlOutput_1 = null;
          String errormessage_tPostgresqlOutput_1;
          if (ne_tPostgresqlOutput_1 != null) {
           // build new exception to provide
           // the original cause
           sqle_tPostgresqlOutput_1 = new java.sql.SQLException(
             e_tPostgresqlOutput_1
               .getMessage()
               + "\ncaused by: "
               + ne_tPostgresqlOutput_1
                 .getMessage(),
             ne_tPostgresqlOutput_1
               .getSQLState(),
             ne_tPostgresqlOutput_1
               .getErrorCode(),
             ne_tPostgresqlOutput_1);
           errormessage_tPostgresqlOutput_1 = sqle_tPostgresqlOutput_1
             .getMessage();
          } else {
           errormessage_tPostgresqlOutput_1 = e_tPostgresqlOutput_1
             .getMessage();
          }

          int countSum_tPostgresqlOutput_1 = 0;
          for (int countEach_tPostgresqlOutput_1 : e_tPostgresqlOutput_1
            .getUpdateCounts()) {
           countSum_tPostgresqlOutput_1 += (countEach_tPostgresqlOutput_1 < 0 ? 0
             : countEach_tPostgresqlOutput_1);
          }

          insertedCount_tPostgresqlOutput_1 += countSum_tPostgresqlOutput_1;

          System.err
            .println(errormessage_tPostgresqlOutput_1);

         }
        }

....

 

}

 

 

 

 

 


Accepted Solutions
Five Stars

Re: Postgres output code error: pstmt_tPostgresqlOutput_1 cannot be resolved

I have posted my answer here:

https://stackoverflow.com/questions/43662405/talend-csv-file-to-postgres/47557062#47557062

 

The problem was i had not defined a 'schema',that is the names and data-types of the columns. I had thought Talend would figure it out since the mapping is 1to1. Also the name is confusing because in Postgres 'schema' means something else.

 

 

View solution in original post


All Replies
Five Stars

Re: Postgres output code error: pstmt_tPostgresqlOutput_1 cannot be resolved

Is it possible somehow to fix the generated code?
Five Stars

Re: Postgres output code error: pstmt_tPostgresqlOutput_1 cannot be resolved

I have posted my answer here:

https://stackoverflow.com/questions/43662405/talend-csv-file-to-postgres/47557062#47557062

 

The problem was i had not defined a 'schema',that is the names and data-types of the columns. I had thought Talend would figure it out since the mapping is 1to1. Also the name is confusing because in Postgres 'schema' means something else.

 

 

View solution in original post

Moderator

Re: Postgres output code error: pstmt_tPostgresqlOutput_1 cannot be resolved

Hello,


@Ivana wrote:
Is it possible somehow to fix the generated code?

You cannot directly edit the code generated for a Talend Job.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog