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?
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
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); }
I wouldn't miss this button if it went away. It addms more confusion than value.
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).
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.
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)
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>
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).
not an issue since we are going to get rid of the "Create Database" button
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-981 This bug is related to RHQ-200