Я не могу подключиться к удаленному mariaDB
. Ниже мой простой код подключения jdbc
:
import java.util.*;
import java.sql.*;
public class Test {
private static Connection con = null;
static {
try {
Class.forName("org.mariadb.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://[some_remote_IP]:3306/billing","root","core@1234");
}catch(Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
if(con!=null) {
System.out.println("conn established");
}
else{
System.out.println("connection failed");
}
}
}
Я постоянно получаю исключение ниже:
java.sql.SQLNonTransientConnectionException: Could not create connection to database server.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:526)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:1779)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1596)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:633)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.wpits.utilss.Test.<clinit>(Test.java:9)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 73
at com.mysql.cj.mysqla.io.Buffer.readInteger(Buffer.java:271)
at com.mysql.cj.mysqla.io.MysqlaCapabilities.setInitialHandshakePacket(MysqlaCapabilities.java:62)
at com.mysql.cj.mysqla.io.MysqlaProtocol.readServerCapabilities(MysqlaProtocol.java:482)
at com.mysql.cj.mysqla.io.MysqlaProtocol.beforeHandshake(MysqlaProtocol.java:367)
at com.mysql.cj.mysqla.io.MysqlaProtocol.connect(MysqlaProtocol.java:1412)
at com.mysql.cj.mysqla.MysqlaSession.connect(MysqlaSession.java:132)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:1726)
... 7 more
connection failed
удаленная mariadb
версия: 5.5.65-MariaDB и для подключения , Я использую загруженный JAR из https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client/2.2.3
, в чем проблема?