MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
snama
Post subject: Error while performing database login with the com.mysql.jdb  PostPosted: Nov 15, 2010 - 05:43 PM
Registered Member
Registered Member


Joined: Nov 15, 2010
Posts: 4

Hi
I am using myeclipse 8.0 and trying to connect to mysql 5.1 db using connector/j. I get

"Error while performing database login with the com.mysql.jdbc.Driver: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not recieved any packets from the server. "

Connection URL : jdbc:mysql://localhost:3306/hibernatedemo
Driver Class Name : com.mysql.jdbc.Driver

The mysql is started as a service. I am able to connect to mysql fine thru the command line client.

Incidently my Connect.java
String url = "jdbc:mysql://localhost/hibernatedemo";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection (url, userName, password);
works fine.

Cannot connect thru the IDE. Please help.
 
 View user's profile Send private message  
Reply with quote Back to top
support-swapna
Post subject: RE: Error while performing database login with the com.mysql  PostPosted: Nov 16, 2010 - 06:18 AM



Joined: Nov 11, 2010
Posts: 2193

snama,

When you select your data base under creating a new data base instance, a connection url is specified with dummy values
ex: jdbc:mysql://<hostname>[<:3306>]/<dbname>
in the above you can replace the host name and dbname according to your set up.
MySql provides two default testbases, mysql and test, that you can use. The username and password are the ones that you give when you set up mysql. Generally it defaults to root for both username and password.
Also please make sure that the mysql server/service is started.
I have attached a screen shot for your reference.

Do let us know how it works for you.

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
snama
Post subject: RE: Error while performing database login with the com.mysql  PostPosted: Nov 16, 2010 - 03:46 PM
Registered Member
Registered Member


Joined: Nov 15, 2010
Posts: 4

Hi,
The mysql server is started and I still get the same error trying to connect to the test database also. However I noticed one thing. Even though I select the MySql Connector/j driver template each time I open the edit connection driver page, it blanks out the next time.

Please help.
 
 View user's profile Send private message  
Reply with quote Back to top
support-swapna
Post subject: RE: Error while performing database login with the com.mysql  PostPosted: Nov 17, 2010 - 05:48 AM



Joined: Nov 11, 2010
Posts: 2193

snama,

I could not replicate it at my end.
Can you answer few more questions :

1) Please paste the installation details here. You can find them at MyEclipse > Installation Summary > Installation Details.
2) What is the message you get when you try to test the driver from the Edit Database Connection Driver window? Replace the localhost with 127.0.0.1 and try again.
3) Can you try running this command to ensure the socket is open for connections?

telnet 127.0.0.1 3306

and ensure that it connects?
4) What is the version of the mysql connector jar you are using?
5) What is the application server on which you are trying to deploy this application?

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
snama
Post subject: RE: Error while performing database login with the com.mysql  PostPosted: Nov 19, 2010 - 12:25 AM
Registered Member
Registered Member


Joined: Nov 15, 2010
Posts: 4

Swapna
Below is the details you asked for
1) Installation details
*** Date:
Thursday, 18 November, 2010 7:08:39 PM EST

** System properties:
OS=WindowsVista
OS version=6.0.0
Java version=1.6.0_13


*** MyEclipse details:
MyEclipse Enterprise Workbench
Version: 8.0
Build id: 8.0-20091120


*** Eclipse details:
MyEclipse Enterprise Workbench

Version: 8.0
Build id: 8.0-20091120

Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-showsplash
-launcher
C:\Users\Vihaan\AppData\Local\Genuitec\MyEclipse 8.x Latest\myeclipse.exe
-name
Myeclipse
--launcher.library
C:\Users\Vihaan\AppData\Local\Genuitec\MyEclipse 8.x Latest\../Common/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519\eclipse_1206.dll
-startup
C:\Users\Vihaan\AppData\Local\Genuitec\MyEclipse 8.x Latest\../Common/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
-install
C:/Users/Vihaan/AppData/Local/Genuitec/MyEclipse 8.x Latest
-configuration
configuration
-vm
C:/Users/Vihaan/AppData/Local/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin/client/jvm.dll

2)In the Edit database Connection Driver window, if I replace localhost with 127.0.0.1:3306 it still gives the same error. The error below is from the error log in the installation summary window.

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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1122)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2260)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:99)
at com.genuitec.eclipse.sqlexplorer.actions.LoginProgress$Login.run(LoginProgress.java:48)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

3)telnet is running fine from the command prompt. It is connecting.
4)Version of connector/j is mysql--connector-5.1.12-bin.jar. I have also downloaded the latest version (i.e. mysql-connector-java-5.1.13.jar) and the same error occurs.

I am not trying to deploy the application yet, I am still trying to develop it :). Myeclipse is the ide I am using.
Please reply!
Thanks,
Soumya
 
 View user's profile Send private message  
Reply with quote Back to top
support-swapna
Post subject: RE: Error while performing database login with the com.mysql  PostPosted: Nov 19, 2010 - 06:27 AM



Joined: Nov 11, 2010
Posts: 2193

Soumya,

I tried installing mysql-connector-java-5.1.13.jar on Version: 8.0 Build id: 8.0-20091120 and it works perfectly.
Are you trying to connect to MySQL which is on a remote system?

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
snama
Post subject: RE: Error while performing database login with the com.mysql  PostPosted: Nov 22, 2010 - 08:09 PM
Registered Member
Registered Member


Joined: Nov 15, 2010
Posts: 4

Nope, MySql is installed on my machine itself.
 
 View user's profile Send private message  
Reply with quote Back to top
support-swapna
Post subject: RE: Error while performing database login with the com.mysql  PostPosted: Nov 23, 2010 - 06:38 AM



Joined: Nov 11, 2010
Posts: 2193

snama,

Can you check the connection url, for unnecessary blank spaces?

Clear the .log file which is at <workspace dir>/.metadata folder,edit the Database Connection Driver and now test the driver. Paste the contents of the .log file here.

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits