Statement stmt = dialect1Connection.createStatement();    stmt.executeQuery("SELECT 1 as col1 FROM rdb$database");  stmt.close();  SQLWarning warning = dialect1Connection.getWarnings();  assertTrue("Connection should have at least one warning.", warning != null);  dialect1Connection.clearWarnings();  assertTrue("After clearing no warnings should be present.", dialect1Connection.getWarnings() == null);  dialect1Connection.close();
try { Statement stmt = dialect1Connection.createStatement();    stmt.executeQuery("SELECT 1 as col1 FROM rdb$database");  stmt.close();  SQLWarning warning = dialect1Connection.getWarnings();  assertTrue("Connection should have at least one warning.", warning != null);  dialect1Connection.clearWarnings();  assertTrue("After clearing no warnings should be present.", dialect1Connection.getWarnings() == null); } finally { dialect1Connection.close(); }
    public void testWarnings() throws Exception {        Properties info = (Properties)getDefaultPropertiesForConnection().clone();        info.setProperty("set_db_sql_dialect", "1");                try {	        // open connection and convert DB to SQL dialect 1	        Connection dialect1Connection = 	            DriverManager.getConnection(getUrl(), info);	            	        Statement stmt = dialect1Connection.createStatement();	        	        // execute select statement, driver will pass SQL dialect 3 	        // for this statement and database server will return a warning	        stmt.executeQuery("SELECT 1 as col1 FROM rdb$database");	        	        stmt.close();	        	        SQLWarning warning = dialect1Connection.getWarnings();	        	        assertTrue("Connection should have at least one warning.", 	            warning != null);	            	        dialect1Connection.clearWarnings();	        	        assertTrue("After clearing no warnings should be present.",	            dialect1Connection.getWarnings() == null);	            	        dialect1Connection.close();        } finally {        	        info.setProperty("set_db_sql_dialect", "3");	        	        Connection dialect3Connection = 	            DriverManager.getConnection(getUrl(), info);	            	        dialect3Connection.close();        }    }