I have a java application that is deployed on AWS EC2 instance. This application is connecting to an AWS RDS db. This works fine. But from my local windows when I debug the code in intellij, it is not able to connect to db because it require an ssh key and EC2 instance ip for connection along with password.
Java application uses oracle hibernate connection with entity manager.
I came across this solution
https://www.jetbrains.com/help/idea/connectivity-problems.html#step-4-check-if-the-connection-with-ssh-ssl
but I don't see SSH configuration option on Tool windows in my Intellij.
Could someone help me on how can I make db connection using java application using intellij or by deploying application in tomcat in my local?
Related
I have an MSAccess database in my local windows. and I need to connect it with java code using Kubernetes.
I tried to use the below:
jdbc:ucanaccess:///run/desktop/mnt/host/c/Users/Public/fdb/F_B_1_2.mdb;jackcessOpener=com.sms-manager.mobile_app.mobileapp.manage.CryptCodecOpener
But it's not working with me.
it's giving java error database not existing.
Is your java application running in container and trying to connect to ms access db which is in another machine? if yes then you can create Kubernetes service and endpoint of your db server or external name of db server. Choose suitable JDBC and ODBC driver to connect to MS Access Database
I have created a web application in Java and hosted it on a VM. It is getting hosted as I can see the start page of web application. But the problem arises when the hosted web application tries to connect to the Postgres database.
This web application is properly getting connected on the local host if I use the following connection string for JDBC:
DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres",
"postgres", "password");
But when hosted on VM it is not getting connected. I tried everything from other stackoverflow thread like this to change the configuration files of Postgres in VM but still it is not working.
Note: Postgres is also running on VM.
I have converted my web application from local host to .war file and deployed this file on the VM.
Can anyone tell if I have to do any other additional settings in order for the hosted web application to query the database in the VM?
Resolved this issue. The problem was that I didn't include some of the jar files that I was using in the web application in Apache Tomcat lib folder.
Do you also run Postgres on VM ? If not you can not connect it through localhost since the localhost for your web app is VM's address. If so check the firewall and allow the 5432 port to be able to connect.
I have hosted a play framework web application on Amazon EC2 instance. The application is not able to connect to a mysql database located on the Amazon RDS instance. When I run the play framework web application on my local computer it successfully connects to the database on the Amazon RDS instance. I checked the database connection credentials in the production conf file many times. Looks correct.
When I do
mysql -h********.rds.amazonaws.com -p****** -u****** db_name
from the local computer it quickly connects. But when I try same connection to RDS from EC2 it throws:
ERROR 2003 (HY000): Can't connect to MySQL server on ********.rds.amazonaws.com
Can anyone kindly help me with this or suggest anything that I may be possibly missing.
Is RDS in VPC?
Yes, Check if EC2 is also in VPC or not.
No, Check security group that EC2 is in, allows the communication over database port
For more info and scenarios, head here
So I created a MySQL DB on amazon running on the same account as my tomcat server, it built and is running correctly but can't connect to the database.
I can access the remote database running the site using tomcat on my computer, and I can access the db through MySQL workbench, but when I deploy and run it I get a 500 whenever the site tries to access the database.
I opened up my security on this database to accept any connection and port(lol), and I checked if the mysql java connector.jar in the WEB-INF/libs file is the latest version. I even tried setting the JDBC connection string to localhost to see if it would pick it up, but no luck.
I think I'm missing something, can anyone think of any reason my website's JDBC can access the remote database server from my machine but not from the amazon tomcat server?
Also, this is a student project I'm building.
Hope this description makes sense, maybe someone can think of something I haven't tried:)
I created an EBS instance including the RDS instance based on MySQL.
I have access to the EC2 instance using SSH via PuTTY and using the MySQL Workbench I've got access to the RDS instance as well and I can create tables and insert data in them.
I developed a Java application using Netbeans 7.3.1 and when I run the application locally while connecting to the MySQL instance on RDS the application shows the same problem although I can connect to MySQL from within Netbeans without a problem, ie I can connect to the database. But as soon as I deploy my simple application onto EBS and run the same application I get the error "Access denied for user ''#'' (using password: YES)"
I added the IP to the Security Group of my RDS instance as well as the EBS instance. Just to be sure.
Still I got the Access Denied error. The JDBC_CONNECTION_STRING environment variable I've set up is "jdbc:mysql://.cdydcnmtkkhw.us-west-1.rds.amazonaws.com:3306/ebdb?user=&password="
When I use any of the tools to connect to this database with that information all works, when I try to connect from my Java application running in Tomcat, I get the Access Denied message.
The Java call I'm using is:
private java.sql.Connection connect = DriverManager.getConnection(jdbcConnect);
This looks more like the stock standard cannot connect to mysql error and nothing really to do with EC2 as you have set up you security group.
See the mysql link. which explains about
SET PASSWORD FOR 'abe'#'host_name' = PASSWORD('eagle');