title: JDBC Java Connection refused: connect
body: <p>I am trying to use JDBC to connected my program to a database ... But I have this error : </p>
  
  <blockquote>
    <p>Connection refused: connect</p>
  </blockquote>
  
  <p>I can connect to the database with mysql -u anonymous -P 3306 -h useastdb.ensembl.org</p>
  
  <p>But with JDBC it's not working ...</p>
  
  <p>My code : </p>
  
  <pre><code>package com.alpaga.rnmysql;
  
  import java.sql.*;
  
  public class RnMysql {
      public static void main() {
          try {
              Connection conn = null;
              conn = DriverManager.getConnection("jdbc:mariadb://useastdb.ensembl.org:3306/xiphophorus_maculatus_rnaseq_95_5", "anonymous", "");
              System.out.print("Database is connected !");
              conn.close();
          } catch(Exception e) {
              System.out.print("Do not connect to DB - Error:"+e);
          }
      }
  }
  </code></pre>