0

I am trying to connect to MariaDB installed in AWS machine from my local machine. 3306 port is opened for that machine from local machine.

I have set bind-address=0.0.0.0 in /etc/my.cnf.d/server.cnf file in aws machine and also has set security group for 3306

From my local machine, when I execute the following java code,

`

    Connection conn = null;

    Class.forName("org.mariadb.jdbc.Driver");

    //STEP 3: Open a connection
    System.out.println("Connecting to a selected database...");
    conn = DriverManager.getConnection(
            "jdbc:mariadb://ip:3306/DB", "username", "password");
    System.out.println("Connected database successfully...");

Gives the following error:

  java.sql.SQLNonTransientConnectionException: Could not connect to ip:3306 : Connection reset
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:175)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:110)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1113)
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:503)
at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:155)
at org.mariadb.jdbc.Driver.connect(Driver.java:86)
Reza Mousavi
  • 4,420
  • 5
  • 31
  • 48
Pooja
  • 85
  • 1
  • 2
  • 15
  • This might help though it's for MySQL but almost similar: https://stackoverflow.com/questions/9766014/connect-to-mysql-on-amazon-ec2-from-a-remote-server – devd Aug 31 '18 at 10:03
  • Thank u devd. But it is because of some firewall issue in organization. I tried the same from wifi network which is working fine... So it is the firewall issue... – Pooja Sep 03 '18 at 11:35

0 Answers0