JDBC Fetch from oracle with Beam -


the below program connect oracle 11g , fetch records. how ever giving me nullpointerexception coder @ pipeline.apply().

i have added ojdbc14.jar project dependencies.

public static void main(string[] args) {          pipeline p = pipeline.create(pipelineoptionsfactory.create());                p.apply(jdbcio.<kv<integer, string>>read()                    .withdatasourceconfiguration(jdbcio.datasourceconfiguration.create(                           "oracle.jdbc.driver.oracledriver", "jdbc:oracle:thin:@hostdnsname:port/servicename")                    .withusername("uname")                    .withpassword("pwd"))                    .withquery("select empid,name employee1")                    .withrowmapper(new jdbcio.rowmapper<kv<integer, string>>() {                      public kv<integer, string> maprow(resultset resultset) throws exception {                        return kv.of(resultset.getint(1), resultset.getstring(2));                      }                    }));          p.run();      } 

is giving below error.any clue?

exception in thread "main" java.lang.nullpointerexception: coder     @ com.google.common.base.preconditions.checknotnull(preconditions.java:228)     @ org.apache.beam.sdk.io.jdbc.jdbcio$read.validate(jdbcio.java:283)     @ org.apache.beam.sdk.io.jdbc.jdbcio$read.validate(jdbcio.java:216)     @ org.apache.beam.sdk.pipeline.applyinternal(pipeline.java:399)     @ org.apache.beam.sdk.pipeline.applytransform(pipeline.java:307)     @ org.apache.beam.sdk.values.pbegin.apply(pbegin.java:47)     @ org.apache.beam.sdk.pipeline.apply(pipeline.java:158)     @ org.apache.beam.examples.v030.jdbcutil.main(jdbcutil.java:21) 

hi there!

sorry error message not helpful, in fact validation step. have filed beam-959 improve this.

you required provide coder such via

.withcoder(kvcoder.of(varintcoder.of(), stringutf8coder.of())` 

i have filed beam-960 improve automation of coder, have in other places in beam.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -