i have maven container run spring boot and connect database with JDBC.
i want connect to host database
(host: Ubuntu/18.04.5 LTS (Bionic Beaver))
(database: mysql Ver 14.14 Distrib 5.7.35, for Linux (x86_64) using EditLine wrapper)
this my connection string
this.conn = DriverManager.getConnection("jdbc:mysql://172.24.0.1:3306/myDB?"+"user=xxxx&password=xxxx");
this my container IP
$ip route show
default via 172.24.0.1 dev eth0
172.24.0.0/16 dev eth0 proto kernel scope link src 172.24.0.10
i can telnet and mysql login with IP 172.24.0.1 or 172.17.0.1 in maven container
$telnet 172.24.0.1 3306
Trying 172.24.0.1...
Connected to 172.24.0.1.
Escape character is '^]'.
telnet 172.17.0.1 3306
Trying 172.17.0.1...
Connected to 172.17.0.1.
Escape character is '^]'.
but i can’t connect via JDBC with IP 172.24.0.1 or 172.17.0.1
Any help and tips are greatly appreciated!