Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用JDBCIO(apache beam)执行存储过程/例程_Java_Postgresql_Jdbc_Apache Beam_Apache Beam Io - Fatal编程技术网

Java 如何使用JDBCIO(apache beam)执行存储过程/例程

Java 如何使用JDBCIO(apache beam)执行存储过程/例程,java,postgresql,jdbc,apache-beam,apache-beam-io,Java,Postgresql,Jdbc,Apache Beam,Apache Beam Io,我正在尝试使用ApacheBeam的JDBCIO执行postgres例程 到目前为止,我已经尝试: .apply(JdbcIO.<MyData>write() .withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create( "org.postgresql.Driver", "jdbc:

我正在尝试使用ApacheBeam的JDBCIO执行postgres例程

到目前为止,我已经尝试:

 .apply(JdbcIO.<MyData>write()
                            .withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create(
                                    "org.postgresql.Driver", "jdbc:postgresql://localhost:5432/postgres")
                                    .withUsername("postgres")
                                    .withPassword("password"))

                            .withStatement("do $$\n" +
                                    "begin " +
                                    "perform test_routine(first := ?, second := ?, age := ?) " +
                                    "end\n" +
                                    "$$;")
                            .withPreparedStatementSetter(new JdbcIO.PreparedStatementSetter<MyData>() {
                                public void setParameters(MyData element, PreparedStatement query)
                                        throws SQLException {
                                    query.setString(1,element.mfirst);
                                    query.setString(2, element.second);
                                    query.setInt(3, element.age);
                                }
                            })
                    );
我已经设法用一个简单的insert语句使它工作,但理想情况下我想调用一个例程。任何帮助都将不胜感激

非常简单:

.withStatement("select test_routine(first := ?, second := ?, age := ?))
.withStatement("select test_routine(first := ?, second := ?, age := ?))