SQL doesn't work like this.
You can use the DatabaseMetaData class, obtained off of the JDBC
Connection class, to inspect the available columns for a query. However,
I'd caution you against constructing a massive disjunction, e.g.
select * from demotable where colA like ".." or colB like
You don't have to create a new Connection every time, but it is not
directly harmful to do so. This recommendation only goes one way (just
because you can create new connections each time, doesn't imply that you
have to, nor necessarily want to).
I wouldn't be worried about any sort of