DbSchema is a comprehensive tool for designing and managing PostgreSQL databases. It provides powerful features, like visual schema design, team collaboration with Git, easy schema deployment, and interactive HTML5 documentation.
Watch the step-by-step video tutorial below:
For written documentation, please continue reading...
Open DbSchema, then click "Connect to Database" on the Main Screen and choose your database system. DbSchema will automatically download the required JDBC driver.
Before starting the connection process in DbSchema, ensure the following conditions are met:
For remote connections, everything starts with providing the correct combination of username and password.
If you fail connecting you may need to check one of the items below.
pg_hba.conf
On the PostgreSQL server, there is a configuration file called pg_hba.conf
. This file controls client authentication.
/data
. /var/lib/pgsql/data/
or /etc/postgresql//main/
. Edit the pg_hba.conf
file and append the following configuration line:
host all all 172.26.64.1/32 scram-sha-256
This allows remote connections from the IP address 172.26.64.1
using the scram-sha-256
authentication method.
After modifying the pg_hba.conf
file, restart PostgreSQL if it's needed to apply the changes:
pg_ctl.exe -D "C:\Program Files\PostgreSQL\\data" restart
sudo systemctl restart postgresql
Ensure that PostgreSQL is restarted for the changes to take effect.
Allowing connections from all hosts (with 0.0.0.0/0
) can expose your server to security risks.
It is recommended to specify only the IP addresses or subnets that need access.
ALTER USER <someUser> PASSWORD '<newPassword>';
openssl x509 -outform der -in <mypemcertificate>.pem -out <newdercert>.der keytool -import -alias <anyname> -keystore <newcertfilename> -file <newdercert>.der # Keytool may ask for a password to generate the newcert. The new certificate will be available in c:\backupEdit the DbSchema.vmoptions (located in the same folder as DbSchema.exe or ./DbSchema.app/Contents/vmoptions.txt on Mac OS) and add this parameters:
-Djavax.net.ssl.trustStore=<Full Path of the newcertfilename that you generated> -Djavax.net.ssl.trustStorePassword=<The password you provided to create the netcertfilename> -Djavax.net.debug=sslIn the connection dialog choose 'Use SSL':
# Use the official PostgreSQL image from the Docker Hub
FROM postgres:latest
# Install dependencies for building the system_stats extension
RUN apt-get update && \
apt-get install -y build-essential postgresql-server-dev-all
# Update the package list and install git
RUN apt-get update && apt-get install -y git
# Clone the system_stats repository
RUN git clone https://github.com/EnterpriseDB/system_stats /usr/src/system_stats
# Build and install the system_stats extension
RUN cd /usr/src/system_stats && \
make && \
make install
# Clean up
RUN apt-get remove -y build-essential postgresql-server-dev-all && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* /usr/src/system_stats
# Set the default command to run PostgreSQL
CMD ["postgres"]
From command prompt or terminal, go into this directory and execute:
docker build -t postgres-with-system-stats .
docker run --name postgres-with-system-stats -e POSTGRES_PASSWORD=xxx -p 5432:5432 -it postgres-with-system-stats
Connect with DbSchema to the docker container as user postgres using the password from the command above, port 5432.
Execute from DbSchema SQL Editor:
CREATE EXTENSION system_stats;