0

I have some code that is just trying to connect to a remote mysql instance. When I try to connect, it is trying to connect to the local box, not the address I provided.

public class JdbcTest {
  static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
  static final String DB_URL = "jdbc:mysql://remoteAddress:port/orderup";
  static final String USER = myuser;
  static final String PASS = mypass;

  public static void main(String[] args) {
    Connection conn = null;
    Statement stmt = null;
    try {
       Class.forName(JDBC_DRIVRE);
       conn = DriverManager.getConnection(DB_URL,USER,PASS);
       stmt = conn.createStatement();
       String sql = "select * from dual);
       ResultSet rs = stmt.executeQuery(sql);

It never gets pass the DriverManager statement. I get an access denied with the address of the box i am logged into, not the remote address i put into the jdbc url. What gives?

I am using Java 8, MySQL 5.6.20, and com.mysql:mysql-connector:5.1.6

Jesper
  • 202,709
  • 46
  • 318
  • 350
Crackerman
  • 717
  • 1
  • 9
  • 22

0 Answers0