This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes My SQL connectionproblem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "My SQL connectionproblem" Watch "My SQL connectionproblem" New topic
Author

My SQL connectionproblem

Mathews P Srampikal
Ranch Hand

Joined: Nov 26, 2002
Posts: 211
Hi,

I am connecting to My SQL database using the below code. But am getting an exception below.

Class.forName("com.mysql.jdbc.Driver");//works fine
System.out.println("My SQL driver loaded: ");
Connection conn = DriverManager.getConnection ("jdbc:mysql://10.1.5.23:3306/mysql", "root", "root");
System.out.println("Connected to My SQL database........ ");

Exception is >>>>>>>>

com.mysql.jdbc.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.

Please help.

Thanks,
Mats.


Thanks,
Mathews
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

Check mysql server (mysqld) is running. Try connecting to mysql through command prompt.Have you try that?
[ September 17, 2008: Message edited by: Vijitha Kumara ]

SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

Hi
like Vijitha said check the connection between you and the db server


Thanks,
Sherif
Mathews P Srampikal
Ranch Hand

Joined: Nov 26, 2002
Posts: 211
Hi,

Sever is running and am able to see data in the DB server

Thanks,
Mats
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My SQL connectionproblem
 
Similar Threads
Could not parse mapping document from resource PojoTestTable.hbm.xml
Hi...jdbc..no active Connections issue...
connecting to Webtrends reporting DB using JDBC-ODBC
Hibernate SQLGrammarException
no active Connection...jdbc newbie