Connect CentOS Postgresql database to Apache Tomcat - postgresql

I've installed both Postgresql and Tomcat on my CentOS 7 VM. I've also populated my table in my Postgres database (a single column with entries 1-1000). My goal is to connect the database to tomcat and to display a webpage that will randomly pick a number from the database and display it. I'm not sure where to start with this. I also have pgadmin3 installed to use as a GUI instead of the command line for Postgres.

You need to set up a Datasource for PostgreSQL in Tomcat. The PostgreSQL JDBC Driver has instructions on how to do this.

Related

Impossible to connect to a PostgreSQL server after a new installation

I have installed postgresql on my new laptop (on Windows).
I see the service postgresql-x64-11 - PostgreSQL Server 11 is running and is automatic. Perfect.
I have installed "dbeaver" (21.21). I would like to create my first database via dbeaver. I always get this message:
Database postgres does not exist
Is it possible to create a database with dbeaver ? Or not ? Or must I do the creation with some command lines ?

How to stop PGAdmin 4 auto detecting a ghost instance?

I had Postgresql 9.6 installed (on Windows 10) and did a complete uninstall including the data directory and all old copies of PgAdmin and there are no environment variables relating to this or any other old Postgres installation either.
I recently installed Postgresql 11 and PgAdmin 4 v3.6 using EnterpriseDB installer. When I run PgAdmin 4 it aurto detects a postgresql instance called 9.6 - though the details tell me it is actually my v11 instance with the same port number and password etc. The only difference is that it is pointing to the non-existent old data directory.
I have searched for a stray postgresql.conf file (and can't find one as it was in the deleted data directory!). As there is also no environment variables, no binaries and no data I can't understand how PgAdmin is auto detecting this ghost. Any suggestions on how to correct it?
EDIT:
I have tried deleting all cookies relating to PgAdmin and Postgresql in Chrome too - this had no effect
I have also double checked that there is no postgresql 9.6 service running (but that just confirms the above where PgAdmin tells me it is called 9.6 but actually is a v11 instance)
Try deleting pgAdmin4 config file pgadmin4.db located at %APPDATA%\pgAdmin\
Restart pgAdmin4 and check.

How to show all servers in PgAdmin III LTS by BigSQL

Postgres PgAdmin server pane contains lot of servers.
BigSQL Postgres 10.1 was installed in Windows 10. It installed also PgAdmin III LTS by BigSQL.
In this PgAdmin server window only servers added in it are shown. For example, if server named testbigsqlsever is added, BigSQL pgAdmin shows it:
How to force it to show also servers installed by earlier PgAdmin III ? Earlier pgAdmin remains also in this computer and it shows all servers.
It looks like both pgadmins store server list in
HKEY_CURRENT_USER\Software\pgAdmin III\Servers
but PgAdmin III LTS by BigSQL does not show servers added by standard pgAdmin.
Since standard pgAdmin does not support Postgres 10 and pgAdmin IV does not have config editors and has poor user interface BigSQL pgAdmin should used. There are number of servers added earlier and manually adding them all requires lot of work

pgAdmin 4 Migrate server list from pgAdmin III

How to migrate/import Server list with login info in pgAdmin 4 from pgAdmin III.
In pgAdmin III installations that was done with migrating pgadmin registry keys with regedit, but as I see new pgAdmin has different registry structure in different location (doesn't use old registry path as pgAdmin3 used).
I'm afraid right now that's not possible, pgAdmin4 will automatically locate all local Postgres installations but for remote server(s) you have to add it manually.

How to remove PostgreSQL as a service?

I have installed PostgreSQL 9.5 in my machine. But there is no UI for that. When I installed pgAdmin I can view the postsql as a service.
Can I remove this service and install as a server like other databases(sql server, my sql)?
You can use pgAdmin III developed for PostgreSQL User Interface Or use cmd its will work. See this thread