|
Code:
JDBCOutputFormat outputFormat =
// create and configure input format
JDBCOutputFormat.buildJDBCOutputFormat().setDrivername("org.apache.derby.jdbc.EmbeddedDriver")
.setDBUrl("jdbc:derby://localhost:1527/firstdb")
.setQuery("insert into testtable (id,name) values (?,?)")
.finish();
outputFormat.open(0, 2);
Row row = new Row(2);
row.setField(0, 100);
row.setField(1, "XYZ");
outputFormat.writeRecord(row);
outputFormat.close();
env.execute();
Error:
Exception in thread "main" java.lang.IllegalArgumentException: open() failed.
at org.apache.flink.api.java.io.jdbc.JDBCOutputFormat.open(JDBCOutputFormat.java:80)
at com.java.application.FlinkFileReader.main(FlinkFileReader.java:92)
Caused by: java.sql.SQLException: DERBY SQL error: SQLCODE: -40001, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'firstdb' with class loader sun.misc.Launcher$AppClassLoader@79f1a8a, see the next exception for details.::SQLSTATE: XSDB6
Please assist ASAP. Thanks.
|