Could you please guide me How can I connect my local SQL developer to MY SQL Server running on Docker container in EC2. But I havent installed mysql in my ec2 host.
I have tried with public dns and port 3306 but getting below error
An error occurred while establishing the connection:
`Long Message:
Communications link failure
The last packet successfully received from the server was 353 milliseconds ago. The last packet sent successfully to the server was 339 milliseconds ago.
Details:
Type: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
SQL State: 08S01`
follow the guide in this official AWS documentation
https://aws.amazon.com/premiumsupport/knowledge-center/connect-http-https-ec2/
Use port 3306 however, this is a guide for webservers
Related
I had a problem here, is it possible that JDBC connecting to the amazon MySQL server remotely? I searching on the Internet for solution but ended up receiving the error
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 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.
I am using jsch.jar to connect the remote server, then call up JDBC connector trying to connect MySQL DB, I had successfully connected to the remote server yet I cannot connect MySQL DB on amazon, here is my code
testPutty t = new testPutty();
t.connect("admin", "", "xx:xx:xx:xx", "openSSHPrivateKey", 22);
t.connect();
System.out.println("connected");
Class.forName("com.mysql.jdbc.Driver");
DriverManager.getConnection("jdbc:mysql://staging.ppyhcsxnlkji.ap-southwest-1.rds.amazonaws.com:3306/staging","superuser","password");
System.out.println("hello world");
t.close();
First set up the tunnel with SSH. You haven't shown what testPutty is so I'll assume it's a thin Java wrapper around a command line invocation of Putty. The command line option for setting up a tunnel is
-L[localport]:[host]:[remoteport]
For your example this would be
-L3306:staging.ppyhcsxnlkji.ap-southwest-1.rds.amazonaws.com:3306
This sets up a tunnel that forwards connections to local port 3306 to port 3306 on the given host (staging...amazonaws.com) on port 3306, routed through the host that is the target of the SSH command (in your sample xx:xx:xx:xx).
Then, your connection string needs to use localhost instead of the actual remote:
jdbc:mysql://localhost:3306/staging
If 3306 on your local host is not available because you are also running a local copy of MySQL, just choose a different unused port.
I am trying to test the connection from NetBeans IDE8.0 with New Connection Wizard to the Cpanel MySql Database .
I already added my machine ip address in the Remote MySql option of Cpanel but still i am not able to connect with database.
I am getting below error message
Cannot establish a connection to jdbc:mysql:// someIP:3306/hariom?zeroDateTimeBehavior=convertToNull using com.mysql.jdbc.Driver (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.)
If your server has ConfigServerFirewall installed you need to open the port there as well event though you turned on remote mysql on your cPanel. If you do not own the server you need to contact the host for this.
This question already has answers here:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
(51 answers)
Closed 6 years ago.
I Have developed an application to capture data, retrieve information,delete and also update info. The application is developed in java swing and hibernate and uses MySQL version 5.5 as a database. I tested it on my local server or local host and its working fine. So now i took it a step further trying to access the database on the remote server. Please note that also the MySQL version i use on my local server is the same as the MySQL in the remote server.
I get the following error:
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 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.
Error Code: 0
The problem is that your MySqlConnector/Driver can't establish a Connection to the remote server.
Check your jdbc URL and also the check if the wrong ports are used.
Maybe the Mysql DB is not reachable from outside, than you can use a port forwarding with ssh, for example :
port forwarding:
ssh -L3306:127.0.0.1:3306 user#remoteServer
than change your jdbc url to:
jdbc:mysql://localhost:3306/database
Explanation:
-L port:host:hostport
Specifies that the given port on the local (client) host is to be
forwarded to the given host and port on the remote side.
...
Whenever a
connection is made to this port, the connection is forwarded over
the secure channel, and a connection is made to host port
hostport from the remote machine.
Source: http://www.openbsd.org/cgi-bin/man.cgi?query=ssh&sektion=1
That means you request with your MySQL JDBC Driver(jdbc url) on the local 3306 port
will be forwarded to the remote server on his local 3306 port,
where the Mysql Database is listing.
I am trying to install "Kwok information server" and I am new to postgreSQL. I just followed the installation guide of Kwok information server.
when I am trying to install kwok-schema-setup.jar file using java through postgreSQL server in Command Prompt, I am getting the following error..."Connecting to PostgreSQL Server ...failed. Connection refused. Check that the ho
stname and port are correct and that the postmaster is accepting TCP/IP connecti
ons. Cause: java.net.ConnectException: Connection refused: connect
Schema setup encountered errors" .
And when I am trying to connect to the server using pgAdmin III, I am getting the following error "Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? ".
Please anyone help me regarding, Thanks in advance!!
Looks like your Postgresql daemon is not running. Check if the server has started and is running. I dont know which OS you are using but try ps -ax on linux/mac or the task manager in windows.
Maybe a firewall that is blocking the connection, you have to provide more information about your environment to be sure.
I've been trying to start the server but I get this error message:
2013-01-23 19:24:18.133 GMT : Security manager installed using the
Basic server security policy. 2013-01-23 19:24:18.430 GMT : Could not
listen on port 1527 on host localhost: java.net.BindException: Cannot
assign requested address: JVM_Bind
On top of that I get a prompt saying:
Unable to connect. Cannot establish a connection to
jdbc:derby://localhost:1527/sample using
org.apache.derby.jdbc.ClientDriver (java.net.SocketException : Error
connecting to server localhost on port 1527 with message Network is
unreachable: connect.).
How is one suppose to fix such an issue?
I had the same issue but my problem was I had my loopback (lo) network interface disabled... took me quite long to discover... (But most common would be another instance of derby already running I think)