I have these three steps bellow which I am executing every moment that I need to create a new environment for my app, the step 3 is just part of code...
On the first step I create the database, second step I make the Roles and Users, and at the end I am making the structure, creating the tables of database.
In my APP I try to connect the database by hibernate, this way:
<property name="connection.url">jdbc:postgresql://localhost:5432/LGP_VREF</property>
<property name="connection.username">lgp_appuserdb</property>
<property name="connection.password">ccccc</property>
...
Usually I don't work with postgres, so I guess I am not understanding the postgres's concept of Roles and Users.
I am getting the following error:
DEBUG BasicResourcePool:1831 - An exception occurred while acquiring a poolable resource. Will retry. org.postgresql.util.PSQLException: FATAL: database "LGP_VREF" does not exist
Why am not I getting the login? Everything seems ok.
My steps for a new ambient:
step 1
CREATE DATABASE "LGP_VREF" WITH OWNER "postgres" ENCODING 'UTF8' LC_COLLATE = 'pt_BR.UTF-8' LC_CTYPE = 'pt_BR.UTF-8';
step 2
CREATE USER adm_userdb_temp WITH PASSWORD 'aaaaa' SUPERUSER VALID UNTIL '2013-07-07';
CREATE USER adm_userdb WITH PASSWORD 'bbbbb' SUPERUSER;
CREATE USER lgp_appuserdb WITH PASSWORD 'ccccc';
CREATE ROLE appUsers INHERIT;
GRANT SELECT, UPDATE, INSERT, DELETE ON ALL TABLES IN SCHEMA public TO appUsers;
GRANT appUsers TO lgp_appuserdb;
step 3
CREATE TABLE students (
id integer NOT NULL,
data_entrada timestamp without time zone DEFAULT now(),
descricao character varying(255),
experiencia character varying(255),
formacao character varying(255),
informacoes character varying(255)
);
ALTER TABLE public.students OWNER TO appUsers;