• Register
0 votes

Problem :

Facing following jdbc issue 

caused by: com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure

6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

Please find below best solution for your problem,

 Connection con = DriverManager.getConnection(
 "jdbc:mysql://localhost:3306/DBname", "root", "root");

Now replace the Localhost with your IP address
 Connection con = DriverManager.getConnection(
 "jdbc:mysql://", "root", "root");

9 7 4
38,600 points

Related questions

0 votes
2 answers 428 views
Problem : I want my database to talk to my Java programs. I am getting following error message. Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The ... (); // ResultSet result = stat.executeQuery( "select * from table" ); System.out.println("Connected?"); } }
asked Dec 10, 2019 alecxe 7.5k points
0 votes
1 answer 3 views
Problem: Can anyone help me with this problem? > No suitable driver found for jdbc:mysql://localhost:3306/.
asked 2 days ago Junia Phoebe 15.3k points
0 votes
1 answer 4 views
Problem: How can I connect java application with oracle and mysql database using jdbc?
asked Apr 22 anika11 32.2k points
0 votes
1 answer 6 views
Problem: Please lend me a hand to create a simple jdbc program in java using mysql .
asked Apr 26 salim1 60.6k points
0 votes
1 answer 132 views
Problem: I want to check if the very specific value already exists in the database. I am currently accessing database from the java standalone app using the JDBC my queries for inserting records into the db are working so my setup and the connection are perfectly fine. ... near 'd-f05708071f8f' at line 1 But if I attempt to execute above command in the MySQL command line then it works properly.
asked Aug 3, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 7 views
Problem: Can anyone please point me in the right direction > Caused by: oracle.net.ns.netexception: the network adapter could not establish the connection
asked Apr 24 ummeshani 10.8k points
0 votes
1 answer 2 views
Problem: Please solve it … Because I am unable to find out the solution .. Class not found exception in java jdbc
asked 1 day ago Ifra 37.2k points
0 votes
1 answer 4 views
Problem: I am trying to make a form where sellers can insert new items, new category and delete items. Now I have problem with DELETE. This is my code and if somebody know how to fix it please help. String id = "42"; try { Class.forName("com.mysql.jdbc.Driver"); Connection ... .out.println("Deleted"); } else { System.out.println("Can't delete"); } } catch (Exception ex) { System.out.println(ex); }
asked Apr 23 munim01 21k points
0 votes
1 answer 32 views
Problem : I am a completely novice in the hibernate world and facing this error: Generationtarget encountered exception accepting command : error executing ddl via jdbc statement .
asked Mar 13 Wafa Abu Yousef 6.1k points
1 vote
1 answer 74 views
Problem : HELP! I need help understanding this error: Error creating bean with name 'employeeRepositoryDAOImple': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory. ... failed; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
asked Mar 12 Sabbir Hossain 14.6k points