Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Updating the Postgresql JDBC Driver

I've cloned tPostgresqlBulkExec and modified it to use COPY FROM STDIN, but COPY FROM STDIN is not supported in postgresql-8.3-603.jdbc3.jar, so I'm trying to update the Postgresql JDBC Driver to a more recent version. Unfortunately, I can not get the tPostgresql components to use a different version of the Postgresql JDBC Driver.
I've gone into the Postgresql *_java.xml files and changed the JDBC driver specified there, no luck. I've changed the file name of a more recent version of the Postgresql JDBC Driver to postgresql-8.3-603.jdbc3.jar and placed it the directories for the tPostgresql components, no luck. The directions listed in https://community.talend.com/t5/Design-and-Development/How-to-update-the-configured-JDBC-driver/td-p... do not work for Talend 5.2.1.
Please advise.
Labels (5)
3 Replies
Anonymous
Not applicable
Author

At first, the driver is used also in the connection component.
If you load at any place in your job an older version of the driver, the newer classes from your driver will not loaded!
Check which tPostgresql components you already use and check if they use also the newer driver version.
Anonymous
Not applicable
Author

Hi Jan,
Thank you for responding. On my entire file system, I've found and replaced all copies of postgresql-8.3-603.jdbc3.jar with postgresql-9.1-903.jdbc3.jar renamed to postgresql-8.3-603.jdbc3.jar. I still get the same error message thrown by 8.3. Because of my situation, I have to drop my work with Talend. Again, thank you for all your kind help.
Anonymous
Not applicable
Author

OK, I've tried again, this time replacing postgresql-8.3-603.jdbc3.jar with postgresql-9.2-1002.jdbc3.jar renamed to postgresql-8.3-603.jdbc3.jar.
I've also inserted this snippet into my code:
java.sql.DatabaseMetaData dbmd = conn_<%=cid%>.getMetaData();
System.out.println("===== Database info =====");
System.out.println("DatabaseProductName: " + dbmd.getDatabaseProductName() );
System.out.println("DatabaseProductVersion: " + dbmd.getDatabaseProductVersion() );
System.out.println("DatabaseMajorVersion: " + dbmd.getDatabaseMajorVersion() );
System.out.println("DatabaseMinorVersion: " + dbmd.getDatabaseMinorVersion() );
System.out.println("===== Driver info =====");
System.out.println("DriverName: " + dbmd.getDriverName() );
System.out.println("DriverVersion: " + dbmd.getDriverVersion() );
System.out.println("DriverMajorVersion: " + dbmd.getDriverMajorVersion() );
System.out.println("DriverMinorVersion: " + dbmd.getDriverMinorVersion() );
System.out.println("===== JDBC/DB attributes =====");
System.out.print("Supports getGeneratedKeys(): ");
if (dbmd.supportsGetGeneratedKeys() )
System.out.println("true");
else
System.out.println("false");
This snippet of code shows that Talend is indeed using the Postgresql 9.2 JDBC Driver.
I've created a component that tries to do COPY FROM STDIN, and fails with this stack trace:
org.postgresql.util.PSQLException: ERROR: COPY from stdin failed: The JDBC driver currently does not support COPY operations.
Where: COPY tmp_customercsv_tmp, line 1
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:395)
at ted.bulkexec_copy_ted_0_1.BulkExec_Copy_TED.tFileInputDelimited_1Process(BulkExec_Copy_TED.java:1353)
at ted.bulkexec_copy_ted_0_1.BulkExec_Copy_TED.tPostgresqlConnection_1Process(BulkExec_Copy_TED.java:564)
at ted.bulkexec_copy_ted_0_1.BulkExec_Copy_TED.runJobInTOS(BulkExec_Copy_TED.java:2379)
I managed to get the source code for the Postgresql 9.2 JDBC Driver from http://jdbc.postgresql.org/download.html, and opened up QueryExecutorImpl.java in a text editor. As the stack trace above suggests, the error message "The JDBC driver currently does not support COPY operations" is found in this file! In 9.2!
I also see code for using COPY FROM STDIN. My guess is that this new functionality can only be accessed by using methods not present in 8.3, while Talend is using methods from 8.3 provided for backwards compatibility.