docker run --rm --name postgresDBTest -e POSTGRES_PASSWORD=dbUserPassword1 -e POSTGRES_USER=dbUser1 -p 5432:5432 -d postgres
docker run --rm -p 80:80 --link postgresDBTest -e 'PGADMIN_DEFAULT_EMAIL=user@domain.com' -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' -d dpage/pgadmin4
dbUser.txt with the following content dbUser1
dbPasswordUser.txt with the following content dbUserPassword1
In [ ]:
%%groovy
String user = new File('/tmp/dbUser.txt').text
String password = new File('/tmp/dbPasswordUser.txt').text
beakerx.dbpassword = password
beakerx.dbuser = user
"done"
In [ ]:
%defaultDatasource jdbc:postgresql://localhost:5432/postgres?user={$beakerx.dbuser}&password={$beakerx.dbpassword}
In [ ]:
CREATE TABLE color (
id serial PRIMARY KEY,
name VARCHAR (50) UNIQUE NOT NULL,
code VARCHAR (50) NOT NULL
)
In [ ]:
INSERT INTO color (id, name, code) VALUES (1001,'AliceBlue','#F0F8FF');
INSERT INTO color (id, name, code) VALUES (1002,'AntiqueWhite','#FAEBD7');
INSERT INTO color (id, name, code) VALUES (1003,'Aqua','#00FFFF');
INSERT INTO color (id, name, code) VALUES (1004,'Aquamarine','#7FFFD4');
INSERT INTO color (id, name, code) VALUES (1005,'Azure','#F0FFFF');
INSERT INTO color (id, name, code) VALUES (1006,'Beige','#F5F5DC');
INSERT INTO color (id, name, code) VALUES (1007,'Bisque','#FFE4C4');
INSERT INTO color (id, name, code) VALUES (1008,'Black','#000000');
In [ ]:
SELECT * FROM color WHERE name LIKE 'A%';
In [ ]:
drop table color