Springboot build executable jar failed - postgresql

I've got an error message like this while building executable jar in IntelliJ, using Maven Projects -> Lifecycle -> package
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"
but when i put my local postgres password in hibernate.cfg it works.
Why building jar must connect to database to work?
The problem is my local postgres and server postgres password are not the same, i can change my local postgres to have same password, but it will be a problem if i have multiple server with different password for different project.

If you use application.properties you must set up the connection like this:
spring.datasource.url=jdbc:postgresql://localhost:5432/yourdb
spring.datasource.username=postgres
spring.datasource.password=sql
spring.datasource.driver-class-name=org.postgresql.Driver

Related

Heroku postgres connection failed because of password auth

I want to connect to the heroku postgres database I have set up using spring boot java. But before that I wanted to try and connect using pgAdmin 4. When I tried this I got an error saying the authentication for the 'username' had failed.
Then I started adding the database to my application.proporties file in spring boot to test it there. I got the samen error message.
This is the error message I got in spring boot: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "username".
I then even tried it in DBeaver. But still the same error.
heroku postgres credentials
application.properties in spring boot java
I checked multiple times if the password and username are the same. I really don't know what to do now, because I can't find any documantation on the heroku website
I'm NO EXPERT but I did have the same problem. I think I fixed it on the page with fields for Host, Port, Maintenance database, Username, Password, ... and then by toggling "save password."

java.net.UnknownHostException: when trying to connect to heroku postgres through intellij

I have just signed up to a free heroku account hoping to try and see if a web app I am making functions properly, all works fine on my local machine connected locally to my postgres db.
I am trying to connect to the heroku postgres db I set up. I have connected fine through pgadmin and also in the application.yaml file so that when in prod profile, it runs on the heroku postgres database.
But if I try and connect to the DB using the intellij database connection, I keep getting an error,
[08001] The connection attempt failed. java.net.UnknownHostException: ec2-54-73-110-26.eu-west-1.compute.amazonaws.com
I have checked everything several times, and all the fields on the database connection wizard are correct. I have also set ssl to true, sslmode to verify-ca and sslfactory to sslfactory:org.postgresql.ssl.NonValidatingFactory
but I get the above error each time.

Laravel 5 + Postgresql Connection

I have some problem in Postgre SQL, i can't connect my project Laravel 5 into Postgre SQL(i'm using PG Admin III), of course i remember the password in the first time i installed the Postgresql. but i think the problem is default username for database PostgreSQL, i try use "root",and "postgres" but both is failed. maybe someone know a default username for postgresql
PS: i've already configuring default into pgsql in database.php file and .env file
note: the error is (i tried in tinker laravel) "PDO exception with message could not find any driver"

is it possible connecting to a POSTGRES database through HSQLDB

I found this template in RC file setup for HSQLDB.
Template for a Postgresql database
urlid blainedb
url jdbc:postgresql://idun.africawork.org/blainedb
username blaine
password losung1
driver org.postgresql.Driver
Is it possible to connect to a postgres database residing on a different server?
I have included the postgres jdbc driver in C:\Program Files\java\jdk 1.6\lib folder and i specified the path in CLASSPATH variable.
Please let me know how to make a connection to a postgres database through HSQLDB. Any specifications need to specify.. like HSQLDB server engine or any other?

rake paperclip:refresh db conection error

I'm using Rails and paperclip and trying to run`
rake paperclip:refresh class=Model_Name_Goes_Here
but I get the error
PG::ConnectionBad: FATAL: password authentication failed for user roy
I can run other rake tasks fine, I expect they are using the database user specified in my database.yml file. Why isn't this paperclip rake task using my database.yml file, instead its trying to connect using the unix user I'm logged in as. Even so this user has all privileges and I can access the database using psql.
I've also tried setting the unix domain socket connections to
local all all trust
in the pg_hba.conf file. which didn't help.
Any suggestions on how to run this rake task?
Edit:
I solved this by writing my own rask task
Model.find_each{|m| m.attachment.reprocess! if m.attachment}