throw new DynaSqlException("Cannot parse the given connection url "+connectionUrl);
throw new DatabaseOperationException("Cannot parse the given connection url "+connectionUrl);
    private void createOrDropDatabase(String jdbcDriverClassName, String connectionUrl, String username, String password, Map parameters, boolean createDb) throws DynaSqlException, UnsupportedOperationException    {        if (JDBC_DRIVER.equals(jdbcDriverClassName))        {            int slashPos = connectionUrl.lastIndexOf('/');            if (slashPos < 0)            {                throw new DynaSqlException("Cannot parse the given connection url "+connectionUrl);            }            int          paramPos   = connectionUrl.lastIndexOf('?');            String       baseDb     = connectionUrl.substring(0, slashPos + 1) + "template1";            String       dbName     = (paramPos > slashPos ? connectionUrl.substring(slashPos + 1, paramPos) : connectionUrl.substring(slashPos + 1));            Connection   connection = null;            Statement    stmt       = null;            StringBuffer sql        = new StringBuffer();            sql.append(createDb ? "CREATE" : "DROP");            sql.append(" DATABASE ");            sql.append(dbName);            if ((parameters != null) && !parameters.isEmpty())            {                for (Iterator it = parameters.entrySet().iterator(); it.hasNext();)                {                    Map.Entry entry = (Map.Entry)it.next();                    sql.append(" ");                    sql.append(entry.getKey().toString());                    if (entry.getValue() != null)                    {                        sql.append(" ");                        sql.append(entry.getValue().toString());                    }                }            }            if (getLog().isDebugEnabled())            {                getLog().debug("About to create database via "+baseDb+" using this SQL: "+sql.toString());            }            try            {                Class.forName(jdbcDriverClassName);                connection = DriverManager.getConnection(baseDb, username, password);                stmt       = connection.createStatement();                stmt.execute(sql.toString());                logWarnings(connection);            }            catch (Exception ex)            {                throw new DynaSqlException("Error while trying to " + (createDb ? "create" : "drop") + " a database: "+ex.getLocalizedMessage(), ex);            }            finally            {                if (stmt != null)                {                    try                    {                        stmt.close();                    }                    catch (SQLException ex)                    {}                }                if (connection != null)                {                    try                    {                        connection.close();                    }                    catch (SQLException ex)                    {}                }            }        }        else        {            throw new UnsupportedOperationException("Unable to " + (createDb ? "create" : "drop") + " a PostgreSQL database via the driver "+jdbcDriverClassName);        }    }