Can you please elaborate on how to get my sql statement into the PreparedStatement using the setAsciiStream() function?

I tried putting my sql string into StreamBufferInputStream and then passing it into the PreparedStatement.setAsciiStream() function, but then PreparedStatement.executeQuery() resulted in an error, which said the SQL command was invalid.