Data connection unsupported character set jdbc

Hello,

When connecting to a database via data connection using jdbc i get an error in the build that says the charset is not supported:

	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at shadow.com.palantir.magritte.magritte_jdbc_source.com.palantir.magritte.jdbc.InterruptibleTask.run(InterruptibleTask.java:41)
	... 24 more
Caused by: java.lang.Throwable: Cp836
	at java.nio.charset.Charset.forName(Charset.java:543)
	at com.ibm.db2.jcc.am.x.<init>(x.java:20)
	at com.ibm.db2.jcc.am.w.a(w.java:12)
	at com.ibm.db2.jcc.am.Agent.getByteToCharConverter(Agent.java:497)
	at com.ibm.db2.jcc.t4.a8.a(a8.java:2438)
	at com.ibm.db2.jcc.t4.ab.a(ab.java:4350)
	at com.ibm.db2.jcc.t4.ab.a(ab.java:2777)
	at com.ibm.db2.jcc.t4.ab.a(ab.java:2698)
	at com.ibm.db2.jcc.t4.ab.q(ab.java:1546)
	at com.ibm.db2.jcc.t4.ab.l(ab.java:735)
	at com.ibm.db2.jcc.t4.ab.d(ab.java:111)
	at com.ibm.db2.jcc.t4.p.c(p.java:44)
	at com.ibm.db2.jcc.t4.av.j(av.java:162)
	at com.ibm.db2.jcc.am.k3.an(k3.java:2249)
	at com.ibm.db2.jcc.am.k4.a(k4.java:4638)
	at com.ibm.db2.jcc.am.k4.b(k4.java:4154)
	at com.ibm.db2.jcc.am.k4.bd(k4.java:774)
	at com.ibm.db2.jcc.am.k4.executeQuery(k4.java:739)
	at shadow.com.palantir.magritte.magritte_jdbc_source.com.palantir.magritte.jdbc.JdbcQueryExecutable.executeQuery(JdbcQueryExecutable.java:129)
	at shadow.com.palantir.magritte.magritte_jdbc_source.com.palantir.magritte.jdbc.JdbcQueryExecutable.lambda$executePreparedStatement$2(JdbcQueryExecutable.java:105)
	at java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)

my settings in data connection:

  • URL jdbc:db2:///
  • driver class is com.ibm.db2.jcc.DB2Driver

I added below JDBC property but this did not help

  • key : value
  • characterEncoding : UTF-8

AIP summary of the error :

The error indicates that the Foundry build failed due to an unsupported character set, specifically “Cp836”. This charset is not recognized by the Java environment, which is causing the extraction process to fail. The error is occurring during the execution of a JDBC query, as seen in the stack trace.

To resolve this issue, you can try specifying a supported character set in your JDBC connection configuration. Check the database connection settings and ensure that a valid charset is being used. If “Cp836” is not required, you might want to switch to a more common charset like “UTF-8”.

If you are unsure about how to change the charset or if the issue persists, it is recommended to consult with Palantir support for further assistance.

Here’s a suggestion for a code change if you have access to the JDBC connection configuration:

  • connection.setCharset(“Cp836”);
  • connection.setCharset(“UTF-8”);
    Unfortunately, there are no direct links to the documentation available for this specific error. If you need further help, contacting Palantir support would be the best course of action.

how can i resolve this?

It sounds like you’re hitting the error also flagged on StackOverflow here.

As suggested on the Stack Overflow post, you may need to modify your agent to use an IBM JDK instead of the JDK that is bundled with the Data Connection agent. Per the instructions at https://www.palantir.com/docs/foundry/data-connection/set-up-agent/#create-agent-host, this should technically be possible by modifying the value of javaHome in service/bin/launcher-static.yml . While those instructions also call out that modifying the JDK in this way is not recommended, I suspect that there aren’t any other good solutions here.

In the interest of completeness, it may also be technically possible to achieve this connection from Python with a source-based external transform using the Agent Proxy runtime, but that would likely be quite difficult.

Thank you for the reply. Modifying the agent seems more risky then getting the data in another way. We will explore that first. thank you!

1 Like

It’s worth noting that you can remove the risk (to other data source connections) by making a separate Agent dedicated to this data source (though of course you’ll then need to set up another server for that Agent to run on)

1 Like