Robert von Burg
40c9ac7969
- Now if you need to perform commands to carry on in your transaction, you can simply use the tx.flush()-method. - Should something go wrong, then even after a tx.flush() one can call throw tx.fail("Reason") or tx.rollbackOnClose() |
||
---|---|---|
.. | ||
src | ||
.gitignore | ||
LICENSE | ||
README.md | ||
pom.xml |
README.md
li.strolch.persistence.postgresql
PostgreSQL Persistence Implementation for Strolch
Setup
-
Install PostgreSQL version with at least version 9.1: $ sudo aptitude install postgresql postgresql-client
-
Set a password for user 'postgres' $ sudo -u postgres psql postgres postgres=# \password postgres
-
Create the user and DB: $ sudo -u postgres psql $ postgres=# create user testUser with password 'test'; create database testdb; GRANT ALL PRIVILEGES ON DATABASE testdb to testuser; GRANT CONNECT ON DATABASE testdb TO testuser ;
For tests:
create user testUser with password 'test'; create database testdb; GRANT ALL PRIVILEGES ON DATABASE testdb to testuser; GRANT CONNECT ON DATABASE testdb TO testuser ; create user testuser1 with password 'test'; create database testdb1; GRANT ALL PRIVILEGES ON DATABASE testdb1 to testuser1; GRANT CONNECT ON DATABASE testdb1 TO testuser1 ; create user testuser2 with password 'test'; create database testdb2; GRANT ALL PRIVILEGES ON DATABASE testdb2 to testuser2; GRANT CONNECT ON DATABASE testdb2 TO testuser2 ;
-
Added new component, setting properties for PostgreSQL DB: PersistenceHandler li.strolch.persistence.api.StrolchPersistenceHandler li.strolch.persistence.postgresql.PostgreSqlPersistenceHandler false <db.url>jdbc:postgresql://localhost/testdb</db.url> <db.username>testUser</db.username> <db.password>test</db.password>
-
Create tables, or allow strolch to due it for you.
Appendix
- To drop the user and DB: postgres=# revoke ALL PRIVILEGES ON DATABASE testdb from testuser; postgres=# drop user testuser; postgres=# drop database testdb;
- Create a database: $ createdb -p 5432 -O drupal -U drupal -E UTF8 testingsiteone -T template0
- Dropping the database $ dropdb -p 5432 -U drupal testingsiteone
- Dumping the database
pg_dump -p 5432 -h localhost -Fc -U drupal --no-owner testingsiteone > /tmp/testingsiteone_
(date +"%Y-%m-%d_%s").pgdump - Restoring the database $ pg_restore -p 5432 -h localhost -Fc -d testingsiteone -U drupal --no-owner < /tmp/path-to-the-file.pgdump