School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,413 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,600 people online right now. Registration is fast and FREE... Join Now!




Communication Error ?

 

Communication Error ?

kueh

17 Jun, 2009 - 06:49 AM
Post #1

New D.I.C Head
*

Joined: 20 May, 2009
Posts: 13

hi all,

i am using eclispe SDK 3.3.2 and mySql for my program, both programs are using the same pc.

here is how i program the database connection
CODE


Connection conn = null;
Statement stmt = null;
ResultSet rs = null;


Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql:///","user", "password");




however i got this error in my console,

Exception: Communications link failure
Last packet sent to the server was 0 ms ago.


Can you guys please tell me what is causing this error ?

thanks in advance.

User is offlineProfile CardPM
+Quote Post


Martyr2

RE: Communication Error ?

17 Jun, 2009 - 08:26 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 7,246



Thanked: 820 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
In your URL try using localhost if you are running the server on the machine that you are developing on. I think what is happening is that you have an invalid URL. Also make sure that mysql is running and that you can connect to it with any other tools/technologies just to make sure that it is all working fine.

You can also try connecting without using eclipse and just do a standard java file test.

smile.gif
User is online!Profile CardPM
+Quote Post

kueh

RE: Communication Error ?

19 Jun, 2009 - 10:26 AM
Post #3

New D.I.C Head
*

Joined: 20 May, 2009
Posts: 13

Hi Martyr2,

i tried connecting with a the similar code above on JCreator ide and i got an output of Exception: com.mysql.jdbc.Driver

having check through several sites , it seems that my delcaration for database connection is correct.

thanks for the advice tho.

smile.gif smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 11:16PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month