Setting up Connection Pools on the Glassfish server

For efficiency and security reasons we use PGConnectionPools which are started and configured on the glassfish Web Application server. The pools are made available to the webapplication or web service as DataSources. Below is an example how to set up two such ConnectionPools. One is for read access only (DataSource) the other one allows to make changes (CRUD) to the database (WriterSource) in this case the database is served by the localhost.

/asadmin create-jdbc-connection-pool --datasourceclassname org.postgresql.ds.PGConnectionPoolDataSource --restype javax.sql.ConnectionPoolDataSource --property user=g4valreader:password=xxxxxx:url="jdbc\:postgresql\://localhost\:5432/g4validation" myjdbc_postgres-pool
./asadmin create-jdbc-resource --connectionpoolid myjdbc_postgres-pool DataSource
./asadmin get domain.resources.jdbc-connection-pool.myjdbc_postgres-pool

./asadmin create-jdbc-connection-pool --datasourceclassname org.postgresql.ds.PGConnectionPoolDataSource --restype javax.sql.ConnectionPoolDataSource --property user=g4valwriter:password=xxxxxxx:url="jdbc\:postgresql\://localhost\:5432/g4validation" myjdbc_postgres-writerpool
./asadmin create-jdbc-resource --connectionpoolid myjdbc_postgres-writerpool WriterSource
./asadmin get domain.resources.jdbc-connection-pool.myjdbc_postgres-writerpool

Web Application/ Web service only need to check that the resources DataSource (reading) and WriterSource (crud) are available → no info about database needed/exposed.

Node: This can not be done via the glassfish WEBAdmin GUI (bug) → need to use command line interface (see above)

-- HansWenzel - 2016-06-07

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2016-06-07 - HansWenzel
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Geant4 All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback