Tuesday, April 3, 2018

postgresql weith java experiments

 Day 1 Attempt:::

psql
psql: FATAL:  role "brent" does not exist

sudo -u postgres -i
createuser brent

CREATE DATABASE test

https://stackoverflow.com/questions/15301826/psql-fatal-role-postgres-does-not-exist


https://stackoverflow.com/questions/11919391/postgresql-error-fatal-role-username-does-not-exist#11919677


Next step, play with postgresql with Java:

http://zetcode.com/java/postgresql/

==========================================
Day 2 Attempt::

psql
CREATE USER brent WITH PASSWORD 'brent';
CREATE ROLE
CREATE DATABASE testing WITH OWNER = brent;
CREATE DATABASE
GRANT ALL PRIVILEGES ON DATABASE testing to brent;
GRANT
\connect testing


create a table::
https://www.tutorialspoint.com/postgresql/postgresql_create_table.htm
https://www.postgresql.org/docs/9.1/static/sql-createtable.html


CREATE TABLE superhero (ID INT PRIMARY KEY NOT NULL, NAME TEXT NOT NULL, AGE INT NOT NULL, POWER TEXT NOT NULL);
CREATE TABLE


\dt
           List of relations
 Schema |   Name    | Type  |  Owner  
--------+-----------+-------+----------
 public | superhero | table | postgres
(1 row)
http://zetcode.com/java/postgresql/

==================


sudo -u postgres createuser --interactive --password batman

sudo -u postgres createdb testdb -O batman


sudo vi /etc/postgresql/9.5/main/pg_hba.conf

sudo service postgresql restart

psql -U batman -d testdb -W

=============================

Day 3 Attempt::


$ su - postgres
$ psql template1
template1=# CREATE USER tester WITH PASSWORD 'test_password';
template1=# GRANT ALL PRIVILEGES ON DATABASE "test_database" to tester;
template1=# \q


sudo -u postgres createdb sqlgraphdb -O batman


sudo -u postgres createdb sqlgraphdb -O batman

psql -U batman -d sqlgraphdb -W

===============================

Day 4 Attempt::

\c testdb
\dt







No comments:

Post a Comment