Specifying a variable name in QUERY WHERE clause in JDBC

Posted by Noona on Stack Overflow See other posts from Stack Overflow or by Noona
Published on 2010-04-09T14:46:50Z Indexed on 2010/04/09 19:53 UTC
Read the original article Hit count: 494

Filed under:
|
|
|

Could someone please give me a link on how to create a query in JDBC that gets a variable name in the WHERE statement, or write an example, to be more specific, my code looks something like this:

      private String getLastModified(String url) {
     String lastModified = null;
     ResultSet resultSet;
String query = "select LastModified from CacheTable where " + 
     " URL.equals(url)";
     try {
      resultSet = sqlStatement.executeQuery(query);
}

Now I need the syntax that enables me to return a ResultSet object where URL in the cacheTable equals url from the method's argument.

thanks

© Stack Overflow or respective owner

Related posts about mysql

Related posts about jdbc