Let’s say I want to avoid using bind variables in JDBC and run SQL using “ad-hoc” statements, e.g:
connection.createStatement().executeQuery("SELECT ...");
Is there any convention / JDBC escape syntax to inline BLOB data types? I know that H2 has this syntax:
INSERT INTO lob_table VALUES (X'01FF');
But that’s not a standard. Any general solutions? Note, I’m interested in a general approach. I know that this can turn out to be terribly inefficient.
There probably isn’t a JDBC escape syntax, so I searched around a bit and found and successfully tested the following:
SQL Server, Sybase ASE, Sybase SQL Anywhere
DB2
Derby, H2, HSQLDB, Ingres, MySQL, SQLite
Oracle
Postgres
See A.H.’s answer for more details about Postgres’ hex encoding
SQL Standard