Bug 536653 (RHQ-981) - Need to document how "Create Database" button on installer works
Summary: Need to document how "Create Database" button on installer works
Keywords:
Status: CLOSED NOTABUG
Alias: RHQ-981
Product: RHQ Project
Classification: Other
Component: Documentation
Version: 1.1
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact:
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-10-14 23:17 UTC by Charles Crouch
Modified: 2015-02-01 23:25 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Charles Crouch 2008-10-14 23:17:00 UTC
The database name you enter on the Create DB screen, is it the database you want to create or the postgres admin database. Do we default the connect url to the right thing?

Comment 1 Joseph Marques 2008-10-14 23:52:48 UTC
quick testing shows me that:

* entering a non-existent db, <blah>, on the "create db" screen will fail with "SQLException: db <blah> does not exist"
* so a try to enter an existing one, just as "postgres" db on a postgres server

other observations:

* it ALWAYS uses "rhq" as the database name, i.e. it ignors the connection url on the installer page, because i had changed the name from "rhq" to "rhq-test"
* create db will fail if the user specified on the installer page is already created

Comment 2 John Mazzitelli 2008-10-15 12:48:34 UTC
Its very simplistic - look at ConfigurationBean lines 346-365 for the answer:

        LOG.info("Will attempt to create user/database 'rhqadmin' using URL [" + getAdminConnectionUrl()
            + "] and admin user [" + getAdminUsername() + "]. Admin password was"
            + (getAdminPassword().length() > 0 ? " not " : " ") + "empty");

        try {
            String sql1, sql2;

            conn = serverInfo.getDatabaseConnection(adminConfig);
            conn.setAutoCommit(true);
            stmt = conn.createStatement();

            if (dbType.equalsIgnoreCase("postgresql")) {
                sql1 = "CREATE ROLE rhqadmin LOGIN ENCRYPTED PASSWORD 'rhqadmin' NOSUPERUSER NOINHERIT CREATEDB NOCREATEROLE";
                sql2 = "CREATE DATABASE rhq WITH OWNER = rhqadmin ENCODING = 'SQL_ASCII' TABLESPACE = pg_default";
            } else if (dbType.equalsIgnoreCase("oracle10g")) {
                sql1 = "CREATE USER rhqadmin IDENTIFIED BY rhqadmin";
                sql2 = "GRANT connect, resource TO rhqadmin";
            } else {
                throw new Exception("Unknown database type: " + dbType);
            }


Comment 3 Jay Shaughnessy 2008-10-15 13:14:53 UTC
I wouldn't miss this button if it went away.  It addms more confusion than value.

Comment 4 John Mazzitelli 2008-10-15 13:24:37 UTC
We originally DID NOT have this button - but some folks thought it was easier to people to get installed by having it (i.e. user would just have to install the database, but not create any special RHQ schema or DB within it - pressing this button would issue all the necessary DDL to get the database ready for RHQ).

We should either a) provide more on-screen help or more wiki documentation that explains what this does or b) find out what users think and if its too confusing and not really ever needed, get rid of it

I would not get rid of it "just because" since it provides a feature that could be helpful (we just don't know if people really use it or not).

Comment 5 Charles Crouch 2008-10-15 14:23:53 UTC
I was on the phone with a customer yesterday who were trying to use this feature, and they couldn't get it to work. I *think* the problem was that the default db url in the create db page was /rhq, which obviously doesn't exist by default, I *think* it should be /postgres.

Comment 6 John Mazzitelli 2008-10-15 14:27:52 UTC
the jdbc url needs to be an admin url which is a confusing part.  the url/user/pass needs to be able to connect to the db server as an admin so the DDL will work - so , yes, charles you are correct. the url needed to be /postgres (which is, by default, a URL that can connect to the postgres DB as an admin with rights to create other databases in the server)

Comment 7 Mark Burchard 2009-01-07 21:27:56 UTC
It's a bad practice to ever enforce use of a default password the way the Create Database function appears to demand it.  As a general rule, default passwords are forbidden in most production shops, for good reason.  To add to the issue, the JON docs instruct the user to bind postgres to all interfaces (*).  Obviously, you need to do this in order to have multiple Server machines talking to the single DB machine, but the way we ask customers to set up postgres leaves them only postgres host-based security.  Add this a typo/1D10T moment (like the wrong bitmask, say 24 instead of 32) when configuring host security in pg_hba.conf, and you have a DB that's open and has a known user/password combination.

<redacted>
The postgres crash I was seeing was due to using an 8.4 beta.  Comment deleted.
</redacted>


Comment 8 John Mazzitelli 2009-01-07 21:33:43 UTC
we might want to consider removing this "create database" button. We currently hardcode the username/password of the created rhq user which as explained in the earlier comment isn't really safe to do.  We currently don't have a way to ask the user for the password to use - which I guess would be the alternative (as opposed to just removing this feature).

Comment 9 John Mazzitelli 2009-01-30 18:28:55 UTC
not an issue since we are going to get rid of the "Create Database" button

Comment 10 Red Hat Bugzilla 2009-11-10 21:20:56 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-981
This bug is related to RHQ-200



Note You need to log in before you can comment on or make changes to this bug.