1. Install postgre data by default. Use a graphical tool in Windows to create a database, and the connection is normal.
2. problems occurred during JDBC connection.
Connection refused. Check that the hostname and port are correct and that the postmaster
Is accepting TCP/IP connections.
This error is found because the-I parameter is not added when the Postgres service is started. Check that this parameter is not found in the default startup service installed in windows. No data for this parameter
The database can only accept local connections. If you try to modify the attribute of this service, add the parameter-I directly. If it fails, you have to register a service again:
Pg_ctl register-n "postgre-server"-u Postgres-P testpwd-o-I-d "C:/....../Data"
Later, I realized that it was okay to change the listen_addresses settings in PostgreSQL. conf, but I never did.
Listen_addresses = '*'
-D declares the data file path, which can also be declared by setting the system environment variable pgdata.
Restart the service and connect to the database with JDBC
Connection rejected: Fatal: No pg_hba.conf entry for host "10.1.22.77", user "s", Database "jminnet", SSL off.
10.1.22.77 is the IP address of the client. It seems that the 10.1.22.77 entry must be added to pg_mirror.conf.
In pg_hba.conf, there is a 127.0.0.1 entry. Copy it again and change 127.0.0.1 to 10.1.22.77.
Restart the service again and use JDBC to connect to the database!