facebook

[Closed] MySQL driver not connecting in DbExplorer

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #234319 Reply

    Rick Geneva
    Member

    I get the following message:

    Error while trying to login to database : com.mysql.jdbc.Driver

    I got this message after not using MyEclipse for about a week. It used to work on another project I had. I deleted the old project now I can’t get the new project to connect. I verified the database connecton by logging in directly to mysql.

    * The driver is in place in the build path for the project.
    * I am able to connect via a main method with the JDBC driver I specified.

    Where else can I check to see what the problem is?

    Thanks,
    Rick

    #234324 Reply

    Riyad Kalla
    Member

    Rick,
    The DB explorer doesn’t take it’s driver settings from your Build Path, so while you have your JDBC JAR in your build path, it’s entirely possible that you have moved or deleted the JAR that the driver was originally configured to use.

    Navigate to your Window > Prefs > MyEclipse > DB Explorer > Drivers settings, select the MyEclipse one and hit Edit, then click on the other tab and make sure thte JAR specified there to have the driver still exists.

    #236184 Reply

    rgabalonzo
    Member

    Hi,

    I get exactly the same error (Error while trying to login to database : com.mysql.jdbc.Driver) when opening a connection to the db.

    I tried your suggestion above and i found out that it just points to startup.jar. Is this how it’s really supposed to be?

    Could there be something wrong with my installation?

    Thanks!

    #236191 Reply

    Brian Fernandes
    Moderator

    rgabalonzo,

    We don’t ship ME with drivers for your database. You would have download a driver and configure it.
    Choose the Driver Libraries tab (the tab next to the one which contains startup.jar), press New and then select your jar file. You should be able to connect to the database just fine.

    Detailed instructions are available in the MyEclipse Database Explorer User Guide which you can find along side the offline Eclipse help.

    Do let us know if you need any further assistance,
    Brian.

    #238712 Reply

    It took me several times to figure this one out. You have to add your driver-connector.jar file in the preferences window before you can access it from the DB Explorer profile screens. If you try to add it by selecting the jar frin the Driver Libraries tab, you can click OK (it’s not shadowed), but nothing happens.

    Jean

    #238721 Reply

    Brian Fernandes
    Moderator

    Jean,

    From your post I’m not sure whether you figured out your problem or you still have one.
    Before you can setup a DB Profile, you do have to setup the corresponding driver in Preferences as you correctly stated. I reiterate that the process is detailed in the Help which we ship with ME. Could you elaborate exactly what you mean by “nothing happens”?

    Also, please post all relavent details in Posting Guidelines.

    Best,
    Brian.

    #238907 Reply

    Brian,

    The prelims: I’m running Windows XPSP2, ME4.0GA, no plugins/org.eclipse.pde.*, JDK1.5, Tomcat 5.5.9, MySQL 4.1.12a, MySQL connector 3.1.10. The mysql.jar is in the classpath.

    I have gone through the help and the BasicDB demo many times. The screens have changed just enough to not match exactly, but not so much that I can’t extrapolate. My previous message was the aha! message when I figured out that there are two places where the New Driver dialog box appears – Window/Preferences/MyEclipse/Database Explorer/Drivers and Database Explorer perspective/New Profile/New Driver. At the time, I was able to a new driver from the Preferences dialog but not the Database Explorer dialog. What I mean by “nothing happens” is when I click on the OK button, the dialog box doesn’t go away.

    I’ve really screwed something up now, because now I can’t add a new driver from either dialog. 🙁

    Jean

    #238912 Reply

    Brian Fernandes
    Moderator

    Jean,

    You don’t need to create a new driver per se, but you can edit the MySQL driver template which we provide. Creating a new driver is okay as well (just an extra step of figuring out the currect URL format)

    I’ll just run through the steps in the Preference page to be sure you’re doing the right thing.

    Open up the Drivers preference page. Now edit the MySQL Connector / J Driver.
    On the Driver Libraries tab, click New and add your driver jar file.
    At this point, the Driver class name combo box should contain a list of drivers, one of which is com.mysql.jdbc.Driver.
    Make sure something is entered in the Example URL field and press OK to complete the dialog.

    Is this happening? If this does not happen, you should probably see some sort of error message in the dialog – something like “Driver class not found” and the OK button will be disabled.
    Are you sure you’re adding the connector jar file? The name should be something like this: mysql-connector-java-3.1.10-ga-bin.jar

    If you do not see an error message, and pressing the OK button does not close the dialog, something is wrong, could you check your .log file for any exceptions?
    Your log file is located at <workspace-dir>/.metadata/.log

    Best,
    Brian.

    #238932 Reply

    Good tip about the log. It says “java.lang.NoClassDefFoundError: org/aspectj/lang/Signature” but the aspectj jars are in my classpath.

    #238936 Reply

    Brian Fernandes
    Moderator

    Jean,

    I listed out a series of steps and a few questions at the end – could you answer those as well?

    Thanks,
    Brian.

    #239119 Reply

    Brian,

    This is starting to bug me because it only happens on this computer. I just reinstalled Eclipse 3.1 and ME4.0GA and it’s still happening. On the Windows/Preferences/MyEclipse/Database Explorer/Drivers page, I have only one blue checkmark – on the JDBC ODBC Bridge. I select MySQL Connector/J Driver and click the Edit button. On the Driver Libraries tab, I already have the mysql.jar listed and the dropdown box for the Driver Class Name contains the five mysql drivers. com.mysql.jdbc.Driver is selected. Clicking on the OK button does nothing except put another

    “!ENTRY org.eclipse.ui 4 0 2005-10-10 23:57:27.500
    !MESSAGE org/aspectj/lang/Signature
    !STACK 0
    java.lang.NoClassDefFoundError: org/aspectj/lang/Signature”

    entry in the .log file. All I can do at this point is cancel.

    If instead of clicking the Edit button, I click the Add button, I can fill in the New Driver info to match the existing MySQL Connector/J Driver entry and as soon as I add the mysql jar to the Driver Libraries, the five Driver classes show up, but I still can’t click the OK button.

    Jean

    #239120 Reply

    Brian Fernandes
    Moderator

    Jean,

    Thanks for the information. So you’re using the same driver jar on this machine and it does not work – but works on other machines? Is this aDefinitely odd / not good.
    I would say this is a driver issue, and you’re using the incorrect jar file, but that is invalid if the same file works on other machines.

    I had a look at the following threads:
    http://forum.java.sun.com/thread.jspa?threadID=617814&messageID=3455895 (see reply 12).
    This seems to suggest that you’re using the debug version of the driver jar instead of the normal version. Could you please check the jar you’re using?
    You’ve got to use mysql-connector-java-3.1.10-ga-bin.jar and not mysql-connector-java-3.1.10-ga-bin-g.jar. Your file name is mysql.jar, so I presume you copied / renamed one of the above jars?

    and
    http://forums.mysql.com/read.php?39,22579,23352#msg-23352
    This suggests adding the aspectrt.jar file to the class path. That means in the Driver Libraries tab, after adding your mysql jar, click New and add aspectrt.jar before clicking Ok.

    What are your command line arguments for starting eclipse? Have you installed any other plugins – I presume not, and that you reinstalled Eclipse 3.1 and 4.0GA to clean locations.

    In the Edit / Add driver dialog I presume the mysql.jar (the driver jar) is the only jar in the list on the Driver Libraries tab. What about the Java Class Path, tab, are any jars listed there (usually is just startup.jar).

    Let us know how it goes,
    Best,
    Brian.

    #239136 Reply

    Brian,

    I was indeed using the debug version of the mysql jar. When I changed to the production version, it worked. Those two forums are good resources. I’ll use them in the future.

    Thanks for all your help,

    Jean

    #239137 Reply

    Brian Fernandes
    Moderator

    Jean,

    Glad you got it workinng and thank you for posting back.

    Best,
    Brian.

Viewing 14 posts - 1 through 14 (of 14 total)
Reply To: [Closed] MySQL driver not connecting in DbExplorer

You must be logged in to post in the forum log in