public Iterator<ResultSet> getIteratorFromQuery(String query)
	{
		Iterator<ResultSet> ret = null;
		Connection connection = null;
		Statement statement = null;

		try
		{
			Class.forName(driver);
			connection = DriverManager.getConnection(url, username, passwd);
			statement = connection.createStatement();
			final ResultSet result = statement.executeQuery(query);

			ret = new Iterator(){
				
				Object nextObject = null;


				public boolean hasNext() {
					try {
						if (nextObject == null) nextObject = result.next();
					} catch (SQLException e) {
						e.printStackTrace();
					}
					
					return nextObject != null;
				}

	
				public Object next() {
					if ((nextObject == null) && (!hasNext()))
						throw new NoSuchElementException();
					Object ret = nextObject;
					nextObject = null;
					return ret;					
				}

				public void remove() {
					throw new UnsupportedOperationException("This iteractor has no remove() method.");
				}
				
			};
			
			statement.close();
			statement = null;

		}
		catch (Exception e)
		{
			System.out.println(e);
		}
		finally
		{
			if (statement != null)
			{
				try
				{
					statement.close();
				}
				catch (SQLException e)
				{
					System.out.println(e);
				}
				statement = null;
			}
			if (connection != null)
			{
				try
				{
					connection.close();
				}
				catch (SQLException e)
				{
					System.out.println(e);
				}
				connection = null;
			}
		}
		return ret;
	}