public static void setLongString(PreparedStatement pstmt, int parameterIndex, String data) throws Exception { // possibly a long string pstmt.setAsciiStream(parameterIndex, new ByteArrayInputStream(data.getBytes()), data.length()); }