I am trying to connect to a database hosted in https://postgres.heroku.com/databases using Netbeans (build-in) Services/Databases. I am getting this error
Cannot establish a connection to jdbc:postgresql://ec2-xx-xxx-xxx-xxx.compute-1.am
I tried this with no issues:
1. Netbeans connecting to a local postgres database.
2. Using PgAdmin III connecting to heroku postgres databases.
I tried downloading the latest postgres driver and use it in netbeans to create connection but the same error.
Thanks in advance!
When connecting outside of Heroku (e.g. locally), add this to the end of your JDBC connection URL:
?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
Related
I am having some troubles to connect my multimodule maven project to proxysql.
When i connect to two different environments - one with mysql 8 and other with mysql 5, the app is connecting fine and working fine.
When I connect to the proxy with mysql-connector via cj driver is throwing:
java.sql.SQLException: Unknown system variable 'query_cache_size'
Tried to change to mariadb and it throws:
java.sql.SQLException: Unknown system variable 'tx_isolation'
This happens with the latest versions of mysql-connector and mariadb client.
When i created a simple maven module(non-spring) via ConnectionFactory is connecting! (mariadb client 2.7.0 or lower)
When i created a simple Spring app and tried to connect - same errors.
Does anyone could help here :(
I am using mybatis as ORM.
Maybe it's the jdbc version inside of the spring or the mybatis one.
I have a problem with displaying my databse structure through Intellij's Data Sources and Drivers page. I can connect to my database which is hosted on a redhat server through using application.properties of my spring project:
spring.datasource.url=jdbc:postgresql://192.168.0.38:5432/cms_database
which works fine. Although, whenever I try to use Intellij's Data Sources and Drivers page I get an Error Message:
[3D000] FATAL: database "cms_database" does not exist.
I can test to connect to database "postgres" which returns a Connection:
DBMS: PostgreSQL (ver. 13.0) Case sensitivity: plain=lower,
delimited=exact Driver: PostgreSQL JDBC Driver (ver. 42.2.5, JDBC4.2)
Ping: 16 ms SSL: no
Any help would be appreciated. If you need any extra info I would be happy to post!
Try to connect with settings from this example
I think you will set hostname wrongly
I've been trying to connect MySQL to Java for a while now but I keep getting this error:
Here's my Admin Properties for the MySQL Server:
I'm using MySQL connector v8.0.19 and I tried using the v5 but still got the same error.
Try to change another MySQL server version, I encounter a bug causing MySQL Server 8.0.17 cannot connect via various of the connector inside Netbeans IDE.
Below are MySQL connector failed to connect MySQL server 8.0.17, which is showing exception of "java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long":
mysql-connector-java-5.1.23-bin.jar
mysql-connector-java-5.1.45-sources.jar
mysql-connector-java-5.1.48-bin.jar
mysql-connector-java-8.0.17.jar
mysql-connector-java-8.0.18.jar
mysql-connector-java-8.0.19.jar
End up I using MySQL server 5.7.26, which development purpose is okay, can connect using any of the connector without any issue.
In one of my project, we are trying to connect to Postgres server via Java application. It gives an error when try to open connection. Stack trace is below -
{"timestamp":"2016-03-17T06:57:18.853Z",
"level":"ERROR",
"thread":"main",
"logger":"com.abc.messaging.status.configuration.ValidateDatabaseConfiguration",
"message":"Failed to initialize data source: \n
### Error opening session. Cause: java.lang.NullPointerException\n
### Cause: java.lang.NullPointerException","context":"default"}
While we have tried following -
Ping db server from application server - it's successful
Telnet db server and port (from app server)- it's also successful
We also tried a simple python script that connects to postgre server. It also connects to db successfully.
We then moved back to our staging server and tried to connect production db server from there. This is also done successfully.
We tried connecting staging db server from production app server, which also we COULDN'T.
We are assuming that we don't have any issue in our application. This is because, from staging server, application can connect to both staging db and production db. There by, it must be some application server issue or something.
PostgreSQL version - Production - 9.4.5 Staging - 9.4.4
Java version - 1.8.31
Any kind of help would be much appreciated.
Thanks in advance.
I have a Java application that uses Hibernate. It's configured to write to a MySQL db. I can say that I configured it correctly because when I run it on my local machine (on Tomcat and Jetty), tables are created in my local db.
However, when I deploy it to Heroku, the tables are not created. Heroku logs:
Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'po
stgres://zzz:zzz#ec2-111-11-111-11.compute-1.a
mazonaws.com:5432/zzz'
Logs
Why is Heroku connecting to this db instead of using my configurations?
Additional info: App is deployed. It's just that the db tables are not created.
It looks like you're trying to establish a MySQL connection to a Postgres database. Either use a Postgres driver instead, or use a MySQL database.
Look here for MySQL databases: https://addons.heroku.com
PS. I'm guessing you used the default Heroku Postgres database - which populates DATABASE_URL with a Heroku Postgres Starter Tier database.
You need to point the DATABASE_URL variable to mysql database.
heroku config:set DATABASE_URL=mysql://xxxxxx