In Postgres database, there is a column type bytea. According to Storing Binary Data, here is the code to write files to bytea column with PreparedStatement:
File file = new File("myimage.gif");
try (FileInputStream fis = new FileInputStream(file);
PreparedStatement ps = conn.prepareStatement("INSERT INTO images VALUES (?, ?)"); ) {
ps.setString(1, file.getName());
ps.setBinaryStream(2, fis, (int) file.length()); // <-- setBinaryStream needed here
ps.executeUpdate();
}
For the current version of JdbcClient (6.1.1), StatementSpec.param() does not support InputStream. I have tried to open up underlying code and cannot find places where doing stream related code.
Missing this feature, will prevent JdbcClient to be used when bytea column exists.
In Postgres database, there is a column type
bytea. According to Storing Binary Data, here is the code to write files tobyteacolumn withPreparedStatement:For the current version of
JdbcClient(6.1.1),StatementSpec.param()does not supportInputStream. I have tried to open up underlying code and cannot find places where doing stream related code.Missing this feature, will prevent
JdbcClientto be used whenbyteacolumn exists.