private int search(String url,String exactURL){
  String sql="SELECT W_ClickCount_ID, TargetURL FROM W_ClickCount WHERE TargetURL LIKE ?";
  int W_ClickCount_ID=0;
  int exactW_ClickCount_ID=0;
  PreparedStatement pstmt=null;
  try {
    pstmt=DB.prepareStatement(sql,null);
    pstmt.setString(1,"%" + url + "%");
    ResultSet rs=pstmt.executeQuery();
    while (rs.next()) {
      W_ClickCount_ID=rs.getInt(1);
      if (exactURL.equals(rs.getString(2))) {
        exactW_ClickCount_ID=W_ClickCount_ID;
        break;
      }
    }
    rs.close();
    pstmt.close();
    pstmt=null;
  }
 catch (  SQLException ex) {
    log.log(Level.SEVERE,sql,ex);
  }
  try {
    if (pstmt != null)     pstmt.close();
  }
 catch (  SQLException ex1) {
  }
  pstmt=null;
  if (exactW_ClickCount_ID != 0)   W_ClickCount_ID=exactW_ClickCount_ID;
  return W_ClickCount_ID;
}

private int search ( String url , String exactURL ) { String sql = "SELECT W_ClickCount_ID, TargetURL FROM W_ClickCount WHERE TargetURL LIKE ?" ; int W_ClickCount_ID = 0 ; int exactW_ClickCount_ID = 0 ; PreparedStatement pstmt = null ; try { pstmt = DB . prepareStatement ( sql , null ) ; pstmt . setString ( 1 , "%" + url + "%" ) ; ResultSet rs = pstmt . executeQuery ( ) ; while ( rs . next ( ) ) { W_ClickCount_ID = rs . getInt ( 1 ) ; if ( exactURL . equals ( rs . getString ( 2 ) ) ) { exactW_ClickCount_ID = W_ClickCount_ID ; break ; } } rs . close ( ) ; pstmt . close ( ) ; pstmt = null ; } catch ( SQLException ex ) { log . log ( Level . SEVERE , sql , ex ) ; } try { if ( pstmt != null ) pstmt . close ( ) ; } catch ( SQLException ex1 ) { } pstmt = null ; if ( exactW_ClickCount_ID != 0 ) W_ClickCount_ID = exactW_ClickCount_ID ; return W_ClickCount_ID ; }
search for click count
