The error states that the index of the illegal character is 6 but the 6th character is the space after SELECT
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://sql3.freemysqlhosting.net:3306/";
static final String USER = "****";
static final String PASS = "****";
public JSONArray getLocation(ArrayList postParameters)
{
Connection conn = null;
HttpEntity httpEntity = null;
try{
Class.forName(JDBC_DRIVER);
System.out.println("Connecting ");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
System.out.println("Connection successful.");
String sql = "SELECT * FROM locations WHERE locTag LIKE '%"+postParameters+"%'";
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(sql);
httpPost.setEntity(new UrlEncodedFormEntity(postParameters,"UTF-8"));
HttpResponse httpResponse = httpClient.execute(httpPost);
httpEntity = httpResponse.getEntity();
i am then getting
java.lang.IllegalArgumentException: Illegal character in path at index 6: select * FROM locations WHERE locTag = '%[locTag=fast]%'
I have also tried encoding but no luck.