PostgreSQL database configuration for MapStore

346 views
Skip to first unread message
Assigned to lorenzo...@geosolutionsgroup.com by me

osjam...@gmail.com

unread,
Apr 25, 2022, 3:53:46 AM4/25/22
to mapstore-developers
Hello,

I am attempting to configure connection to PostgreSQL on the same server as the MapStore installation.  I have followed my GeoSolutions training, followed the on-line guides (https://training.mapstore.geosolutionsgroup.com/administration/database.html) and looked at past conversations on here, but still having issues.

I have successfully installed PostgreSQL and amended the geostore-datasource-ovr.properties file as follows:

# Setup driver and dialect for PostgreSQL database
geostoreDataSource.driverClassName=org.postgresql.Driver
geostoreVendorAdapter.databasePlatform=org.hibernate.dialect.PostgreSQLDialect

# Connection parameters
geostoreDataSource.url=jdbc:postgresql://localhost:5432/geostore
geostoreDataSource.username=geostore
geostoreDataSource.password=geostore
geostoreEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=geostore

# Automatic create-update database mode
geostoreEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=validate

# Other options
geostoreVendorAdapter.generateDdl=true
geostoreVendorAdapter.showSql=false

As the database is on the same server, I assume the pg_hba.conf doesn't need to be edited to allow access.  To keep things simple at present, I haven't externalised the configurations.  I assume also that the PostgreSQL driver is installed with MapStore (postgresql-42.2.23.jar).

Once set up, MapStore opened fine and I was able to test by adding a new user.  I then looked at the PostgreSQL database and the user has not been added to the table.  I then opened the geostore.h2.db in notepad and noticed that the user seems to be added to the h2 database.

I then noticed that the the maximum version of PostgreSQL should be 13 and I was using v14.1, so I then set up v13.6 to see if this would resolve the issue, but it didn't.

My questions now are, perhaps v13.6 is still above the maximum version that may be causing the issue or have I missed some extra configuration to get MapStore to communicate with PostgreSQL?

Many thanks in anticipation.

Regards

Owen



Lorenzo Natali

unread,
Apr 28, 2022, 3:57:46 AM4/28/22
to mapstore-developers
Hi, 
from my understanding, your MapStore for some reason is still using h2 database configuration. 
In fact, it looks like it is still using the original file, containing the h2 db configuration. 
Make you sure than the file geostore-datasource-ovr.properties is correctly located in the classpath (It should stay in <TOMCAT_HOME>/webapps/mapstore/WEB-INF/classes ) and that you restarted MapStore correctly (there is a known bug about stopping tomcat that may require you to kill the process manually).

osjam...@gmail.com

unread,
Apr 28, 2022, 6:18:41 AM4/28/22
to mapstore-developers
Hi Lorenzo,

Thanks for the advice.

It looks like it was related to the known bug, well, I assume.  I didn't need to shut MapStore manually, however it seems to have started and connected to PostgreSQL today by itself, presumably because I fully turned off the computer.

My other question was regarding the version of PostgreSQL to use.  I have use the current MapStore war file and the PostgreSQL version recommended is 13.  I downgraded from v14.1 to v13.6 to try to resolve the connection problems.  Would you please confirm that v14.1 should not be used and to use v13.6?

Many thanks

Owen

Reply all
Reply to author
Forward
0 new messages