This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Removing Eclipse Ganymede

 
Emmanuel Waûters
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo,


I've again followed Your instructions. Yesterday before I've removed and reinstalled MySQL, so the MySQL JDBC driver and the version of MySQL matched those of my fellow student who's program worked. So I needed to change the password. I've included in the commandline as You asked.
Please see here what I got:




C:\Users\Emmanuel\Contacts\Documents\Informatica\Java\SCJP-oefeningen>javac -d b
uild src/ConnectDB.java

C:\Users\Emmanuel\Contacts\Documents\Informatica\Java\SCJP-oefeningen>java -cp b
uild;build/mysql-connector-java-5.1.7-bin.jar ConnectDB
SQL problem
Communications link failure

Last packet sent to the server was 0 ms ago.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link fai
lure

Last packet sent to the server was 0 ms ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1
074)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2120)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:723)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:282)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at ConnectDB.main(ConnectDB.java:9)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communicatio
ns link failure

Last packet sent to the server was 0 ms ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1
074)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:335)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2043)
... 12 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:209)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
va:253)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
... 13 more

C:\Users\Emmanuel\Contacts\Documents\Informatica\Java\SCJP-oefeningen>

Thanks forward.


Emmanuel
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You forgot to add the port number (3306) to the connection URL.

Looks like others are having a similar problem: http://forums.mysql.com/read.php?39,191966,191966#msg-191966

Try this: get the MySQL driver from the Maven repository and use it (instead of the one you are using). The URL is:
http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar
 
Emmanuel Waûters
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Mister Johnson,




Thousand times thanks for You persistent help. The problem is solved and I will post the solution here. You had the solution. I didn't understand it well – so I looked over it-. My excuses for it, but I'm a really greenhorn in much things of computers. I have to say You already had it right at the beginning.


So the problem was, that due to some circumstances – some people say an update of Windows Vista- the system didn't recognize anymore the relative variable localhost. So using the relative address localhost in my java application or using this address in adding a database to Eclipse, didn't work. So Mr Gert Cuppens –here is the link to his personal website with all matters on the subject Java and related subjects – suggested me to put the absolute address into the java application – the IP-address 127.0.0.1 instead of localhost – , so the application will work. What it did.

And here it comes where You solved the problem. If You add or better said write - because when You open the file with notepad for example You can write into this document - 127.0.0.1 localhost into the file hosts of the directory C:\Windows\System32\drivers\etc You can go on using localhost as an relative address in Your applications. So You don't have to fill anymore the absolute – IP – address – what reduce faults – in Your applications..


I want to express another time my gratefullness for all the help You provided me. I owe You a big, big, big favour. So I want to offer You something to show my thankfullness for Your persistent help.
My e-mailaddress is wauters underscore emmanuel at hotmail dot com, all in one line. So could you
give me an address where I can send the present to.



Yours sincerely,



Emmanuel Waûters
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to admit that it is frustrating when I ask someone to change something (update the etc/hosts file), and later ask them if they have done that, only to find that they ignored my suggestion when that suggestion would have solved their problem. Sigh. (I'd put the head-banging icon here but I can't stand icons that move...)
 
Emmanuel Waûters
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Mister Johnson,


The problem is that some suggestions I didn't understood well or presumed to have understood. But I will never forget it anymore.
I have to say, by following Your instructions, I understand more about my operating system, the maps on my computer,....

Always willing to return a favour.


Yours sincerely,


Emmanuel Waûters
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic