I have some code that needs to form a connection to a server, and once that connection is formed the server interprets the string that is sent and updates the names in a database. I.e. I send "http://app.sitename.tv/api/add/aName" and it adds "aName" to the database, or i send "http://app.sitename.tv/api/remove/aName" and it removes the name.
When I type these links into a browser and run it it works fine. From my program, though, it doesn't throw any exceptions but does not update the database. I'm not sure where to go from here. I've tried turning off my firewall but it makes no difference.
if ((Boolean) value)
{
System.out.println("setValue");
try
{
String bvURL = "http://app.sitename.tv/api/add/" + data.name.get(row);
URL myURL = new URL(bvURL);
URLConnection myURLConnection = myURL.openConnection();
myURLConnection.connect();
System.out.println(bvURL);
}
catch (MalformedURLException e)
{
System.err.println("MalformedURLException: " + e);
}
catch (IOException e)
{
System.err.println("IOException: " + e);
}
}
else if ((Boolean) value == false)
{
System.out.println("setValue");
try
{
String bvURL = "http://app.sitename.tv/api/remove/" + data.name.get(row);
URL myURL = new URL(bvURL);
URLConnection myURLConnection = myURL.openConnection();
myURLConnection.connect();
System.out.println(bvURL);
}
catch (MalformedURLException e)
{
System.err.println("MalformedURLException: " + e);
}
catch (IOException e)
{
System.err.println("IOException: " + e);
}
}