@Test
	public void testSchemaPermissionException() throws Exception
	{
		boolean thrown = false;
		PersistenceManager persist = null;
		
		//create a normal PersistManager
		persist = new PersistenceManager(driver, database, login, password);
		assertTrue(persist.getPersist().isCreateSchema());
		persist.getPersist().setCreateSchema(false);
		assertFalse(persist.getPersist().isCreateSchema());
		persist.getPersist().setCreateSchema(true);
		assertTrue(persist.getPersist().isCreateSchema());
		persist.close();
		persist = new PersistenceManager(driver, database, login, password, false);
		assertFalse(persist.getPersist().isCreateSchema());
		persist.close();
		
		
		try
		{
			persist = new PersistenceManager(driver, database, login, password);
			ConnectionWrapper cw = persist.getConnectionWrapper();
			Connection c = cw.getConnection();
			c.prepareStatement("DROP TABLE " + Defaults.HAS_A_TABLENAME).execute();
			cw.commitAndDiscard();			
		}
		catch (Exception e)
		{
			// don't care, this just means the table didn't exist
		}
		finally
		{
			if (persist != null)
			{
				persist.close();
			}
		}

		try
		{
			// create a manager that doesn't allow schema updates
			persist = new PersistenceManager(driver, database, login, password, false);
		}
		catch (SQLException e)
		{
			if (e.getCause() instanceof SchemaPermissionException)
			{
				thrown = true;
			}
		}
		finally
		{
			if (persist != null)
			{
				persist.close();
			}
		}
		assertTrue("Could update schema despite not having permission.", thrown);
	}