i can't connect to the database

The program was connect to the database and today without a reason the program crash and i can't connect to the database, in my local database connects without a problem spring: datasource: url: DATABASE_URL username: postgres password: PGPASSWORD driver-class-name: org.postgresql.Driver jpa: hibernate: ddl-auto: update show-sql: false properties: hibernate: format_sql: true database: postgresql database-platform: org.hibernate.dialect.PostgreSQLDialect
Solution:
i change the database to mysql and it's works, i don't know why, thanks for the help
Jump to solution
24 Replies
Percy
Percy10mo ago
Project ID: N/A
Brody
Brody10mo ago
are you still using a legacy database?
Σaκaλaμ
ΣaκaλaμOP10mo ago
no, i create and a new database to try again and nothing
Brody
Brody10mo ago
can i see a screenshot of your railway project please
Σaκaλaμ
ΣaκaλaμOP10mo ago
No description
Brody
Brody10mo ago
whats the error you get in the deploy logs?
Σaκaλaμ
ΣaκaλaμOP10mo ago
Caused by: java.lang.RuntimeException: Driver org.postgresql.Driver claims to not accept jdbcUrl,
Caused by: java.lang.RuntimeException: Driver org.postgresql.Driver claims to not accept jdbcUrl,
Brody
Brody10mo ago
your url is the incorrect format, @aleks - please advise
Σaκaλaμ
ΣaκaλaμOP10mo ago
i just copy paste the url that is in the postgres
Σaκaλaμ
ΣaκaλaμOP10mo ago
No description
Brody
Brody10mo ago
aleks will need to advise further
Σaκaλaμ
ΣaκaλaμOP10mo ago
thank you i get and this error now
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:354) ~[postgresql-42.6.0.jar:42.6.0]
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:354) ~[postgresql-42.6.0.jar:42.6.0]
root
root10mo ago
Try using DATABASE_PRIVATE_URL instead. Actually, belay that Set these environment variables:
SPRING_DATASOURCE_PASSWORD=${{Postgres.PGPASSWORD}}
SPRING_DATASOURCE_URL=jdbc:postgresql://${{Postgres.RAILWAY_PRIVATE_DOMAIN}}:5432/${{Postgres.PGDATABASE}}
SPRING_DATASOURCE_USERNAME=${{Postgres.PGUSER}}
SPRING_DATASOURCE_PASSWORD=${{Postgres.PGPASSWORD}}
SPRING_DATASOURCE_URL=jdbc:postgresql://${{Postgres.RAILWAY_PRIVATE_DOMAIN}}:5432/${{Postgres.PGDATABASE}}
SPRING_DATASOURCE_USERNAME=${{Postgres.PGUSER}}
why the thumbs down
Brody
Brody10mo ago
hardcoding private host and port, you know better 🤣
root
root10mo ago
You can remove your custom database URL configuration, too It always runs on 5432, and it's not like there are environment variables for that At least, I don't think there are
Brody
Brody10mo ago
there are though 😬
root
root10mo ago
Please enlighten me
Brody
Brody10mo ago
you new around here 🤣
root
root10mo ago
PGPORT is the public port, so that won't work
root
root10mo ago
oh interesting they keep adding them, I don't check that page very often still, though, I can't not hardcode the port
Brody
Brody10mo ago
i think i added them to the page, when they added support for tcp proxys long ago close enough 🤣
Σaκaλaμ
ΣaκaλaμOP10mo ago
Already try it not working
Solution
Σaκaλaμ
Σaκaλaμ10mo ago
i change the database to mysql and it's works, i don't know why, thanks for the help
Want results from more Discord servers?
Add your server