Cannot connect to MySQL server from external IPV4 address [duplicate]
This question already has an answer here:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
30 answers
I have been having a problem with my Java application for a while now. I have tried several options in trying to figure out what is wrong from new drivers to registering the driver to changing permissions on my MySQL database. I only get this problem when I connect with an external IP. I think it might have something to do with IPV6 but I have attempted to disable that on my raspberry pi but when I run "netstat -tlnp" I get this:
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:8200 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::5900 :::* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN
This shows that MySQL server is still running off of tcp6 the port is 8080 I changed it from the standard 3600. My java main class looks like this: `public static String IP; //NULL Variables for the MySQL server IP
public static final String user = "user"; //Username for the mySQL sever
public static final String password = "pass"; //Password for the mySQL server TODO figure out how to hide password
static Connection conn; //NULL connection to get connected to the mySQL server
public static Scanner console = new Scanner(System.in); //Used to get numbers and strings from console
/**
* Runs the program
* @param args
*/
public static void main(String args) {
System.out.print("Internal or External IP (1 for Internal or 2 for external): ");
int choice = console.nextInt();
switch (choice){
case 1:
IP = "10.0.0.183";
break;
case 2:
IP = "external ipv4 address";
break;
}
//TRY CATCH method to ensure that the mySQL connection was successful
try{
conn = DriverManager.getConnection("jdbc:mysql://"+IP+":8080/mydb",user,password);
}catch(SQLException e){
System.out.println(e.getLocalizedMessage());
System.exit(1);
}`
This is the error I get when I try to connect to my external IPV4 address `Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.`
Does anyone have a solution or need anything else from me to help solve this problem! Thanks!
java mysql jdbc raspberry-pi ipv4
marked as duplicate by K.Nicholas, Mark Rotteveel
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 11:59
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
30 answers
I have been having a problem with my Java application for a while now. I have tried several options in trying to figure out what is wrong from new drivers to registering the driver to changing permissions on my MySQL database. I only get this problem when I connect with an external IP. I think it might have something to do with IPV6 but I have attempted to disable that on my raspberry pi but when I run "netstat -tlnp" I get this:
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:8200 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::5900 :::* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN
This shows that MySQL server is still running off of tcp6 the port is 8080 I changed it from the standard 3600. My java main class looks like this: `public static String IP; //NULL Variables for the MySQL server IP
public static final String user = "user"; //Username for the mySQL sever
public static final String password = "pass"; //Password for the mySQL server TODO figure out how to hide password
static Connection conn; //NULL connection to get connected to the mySQL server
public static Scanner console = new Scanner(System.in); //Used to get numbers and strings from console
/**
* Runs the program
* @param args
*/
public static void main(String args) {
System.out.print("Internal or External IP (1 for Internal or 2 for external): ");
int choice = console.nextInt();
switch (choice){
case 1:
IP = "10.0.0.183";
break;
case 2:
IP = "external ipv4 address";
break;
}
//TRY CATCH method to ensure that the mySQL connection was successful
try{
conn = DriverManager.getConnection("jdbc:mysql://"+IP+":8080/mydb",user,password);
}catch(SQLException e){
System.out.println(e.getLocalizedMessage());
System.exit(1);
}`
This is the error I get when I try to connect to my external IPV4 address `Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.`
Does anyone have a solution or need anything else from me to help solve this problem! Thanks!
java mysql jdbc raspberry-pi ipv4
marked as duplicate by K.Nicholas, Mark Rotteveel
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 11:59
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1) firewall? 2) User table see stackoverflow.com/a/15707789/2310289
– Scary Wombat
Nov 20 '18 at 2:14
add a comment |
This question already has an answer here:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
30 answers
I have been having a problem with my Java application for a while now. I have tried several options in trying to figure out what is wrong from new drivers to registering the driver to changing permissions on my MySQL database. I only get this problem when I connect with an external IP. I think it might have something to do with IPV6 but I have attempted to disable that on my raspberry pi but when I run "netstat -tlnp" I get this:
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:8200 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::5900 :::* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN
This shows that MySQL server is still running off of tcp6 the port is 8080 I changed it from the standard 3600. My java main class looks like this: `public static String IP; //NULL Variables for the MySQL server IP
public static final String user = "user"; //Username for the mySQL sever
public static final String password = "pass"; //Password for the mySQL server TODO figure out how to hide password
static Connection conn; //NULL connection to get connected to the mySQL server
public static Scanner console = new Scanner(System.in); //Used to get numbers and strings from console
/**
* Runs the program
* @param args
*/
public static void main(String args) {
System.out.print("Internal or External IP (1 for Internal or 2 for external): ");
int choice = console.nextInt();
switch (choice){
case 1:
IP = "10.0.0.183";
break;
case 2:
IP = "external ipv4 address";
break;
}
//TRY CATCH method to ensure that the mySQL connection was successful
try{
conn = DriverManager.getConnection("jdbc:mysql://"+IP+":8080/mydb",user,password);
}catch(SQLException e){
System.out.println(e.getLocalizedMessage());
System.exit(1);
}`
This is the error I get when I try to connect to my external IPV4 address `Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.`
Does anyone have a solution or need anything else from me to help solve this problem! Thanks!
java mysql jdbc raspberry-pi ipv4
This question already has an answer here:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
30 answers
I have been having a problem with my Java application for a while now. I have tried several options in trying to figure out what is wrong from new drivers to registering the driver to changing permissions on my MySQL database. I only get this problem when I connect with an external IP. I think it might have something to do with IPV6 but I have attempted to disable that on my raspberry pi but when I run "netstat -tlnp" I get this:
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:8200 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 547/java
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::5900 :::* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN
This shows that MySQL server is still running off of tcp6 the port is 8080 I changed it from the standard 3600. My java main class looks like this: `public static String IP; //NULL Variables for the MySQL server IP
public static final String user = "user"; //Username for the mySQL sever
public static final String password = "pass"; //Password for the mySQL server TODO figure out how to hide password
static Connection conn; //NULL connection to get connected to the mySQL server
public static Scanner console = new Scanner(System.in); //Used to get numbers and strings from console
/**
* Runs the program
* @param args
*/
public static void main(String args) {
System.out.print("Internal or External IP (1 for Internal or 2 for external): ");
int choice = console.nextInt();
switch (choice){
case 1:
IP = "10.0.0.183";
break;
case 2:
IP = "external ipv4 address";
break;
}
//TRY CATCH method to ensure that the mySQL connection was successful
try{
conn = DriverManager.getConnection("jdbc:mysql://"+IP+":8080/mydb",user,password);
}catch(SQLException e){
System.out.println(e.getLocalizedMessage());
System.exit(1);
}`
This is the error I get when I try to connect to my external IPV4 address `Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.`
Does anyone have a solution or need anything else from me to help solve this problem! Thanks!
This question already has an answer here:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
30 answers
java mysql jdbc raspberry-pi ipv4
java mysql jdbc raspberry-pi ipv4
edited Nov 20 '18 at 2:22


Marcus Campbell
2,01921027
2,01921027
asked Nov 20 '18 at 1:12
Tech GuyTech Guy
1
1
marked as duplicate by K.Nicholas, Mark Rotteveel
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 11:59
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by K.Nicholas, Mark Rotteveel
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 11:59
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1) firewall? 2) User table see stackoverflow.com/a/15707789/2310289
– Scary Wombat
Nov 20 '18 at 2:14
add a comment |
1) firewall? 2) User table see stackoverflow.com/a/15707789/2310289
– Scary Wombat
Nov 20 '18 at 2:14
1) firewall? 2) User table see stackoverflow.com/a/15707789/2310289
– Scary Wombat
Nov 20 '18 at 2:14
1) firewall? 2) User table see stackoverflow.com/a/15707789/2310289
– Scary Wombat
Nov 20 '18 at 2:14
add a comment |
1 Answer
1
active
oldest
votes
have you created MySQL user using this 10.0.0.183?
please create MySQL user using this and provide grant and check it
I have done that. I am able to connect perfectly fine to my server on the 10.0.0.183 IP address but I am having troubles connecting from the "external ipv4 address". Thanks for the response!
– Tech Guy
Nov 21 '18 at 1:18
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
have you created MySQL user using this 10.0.0.183?
please create MySQL user using this and provide grant and check it
I have done that. I am able to connect perfectly fine to my server on the 10.0.0.183 IP address but I am having troubles connecting from the "external ipv4 address". Thanks for the response!
– Tech Guy
Nov 21 '18 at 1:18
add a comment |
have you created MySQL user using this 10.0.0.183?
please create MySQL user using this and provide grant and check it
I have done that. I am able to connect perfectly fine to my server on the 10.0.0.183 IP address but I am having troubles connecting from the "external ipv4 address". Thanks for the response!
– Tech Guy
Nov 21 '18 at 1:18
add a comment |
have you created MySQL user using this 10.0.0.183?
please create MySQL user using this and provide grant and check it
have you created MySQL user using this 10.0.0.183?
please create MySQL user using this and provide grant and check it
answered Nov 20 '18 at 6:51
Atul AkabariAtul Akabari
954
954
I have done that. I am able to connect perfectly fine to my server on the 10.0.0.183 IP address but I am having troubles connecting from the "external ipv4 address". Thanks for the response!
– Tech Guy
Nov 21 '18 at 1:18
add a comment |
I have done that. I am able to connect perfectly fine to my server on the 10.0.0.183 IP address but I am having troubles connecting from the "external ipv4 address". Thanks for the response!
– Tech Guy
Nov 21 '18 at 1:18
I have done that. I am able to connect perfectly fine to my server on the 10.0.0.183 IP address but I am having troubles connecting from the "external ipv4 address". Thanks for the response!
– Tech Guy
Nov 21 '18 at 1:18
I have done that. I am able to connect perfectly fine to my server on the 10.0.0.183 IP address but I am having troubles connecting from the "external ipv4 address". Thanks for the response!
– Tech Guy
Nov 21 '18 at 1:18
add a comment |
1) firewall? 2) User table see stackoverflow.com/a/15707789/2310289
– Scary Wombat
Nov 20 '18 at 2:14