3 Replies Latest reply on Nov 17, 2010 10:27 PM by jschellSomeoneStoleMyAlias

    Problem connecting to Mysql via Eclipse

    785454

      Hello all
      I'm new to Mysql and i'm having some connection problem
      I use Mysql and Eclipse on my Mac osx 10.5.
      I have downloaded the correct Mysql version for my osx (10.5) .dmg archive and the Connector J version: 5.1.13
      I'm following the steps of this tutorial:
      http://obscuredclarity.blogspot.com/2009/08/setup-mysql-development-in-eclipse.html
      In the "database development" perspective i select the just downloaded Connector J as driver and select Mysql as Database, when i try to estabilish a connection i get the following error in a small dialog frame: "Creating connections to New Mysql has encountered a problem, Could not connect to New Mysql"
      If i click on details i get the following StackTrace:
      "Could not connect to New MySQL.
      Error creating SQL Model Connection connection to New MySQL. (Error: Communications link failure , the driver has not received any packets from the server"

      I'm new to databases and i really dont know where to start debugging.
      Any advice?
      Thank you

        • 1. Re: Problem connecting to Mysql via Eclipse
          jschellSomeoneStoleMyAlias
          Communication errors mean the problem is outside of java.

          Some possibilities
          - Database isn't running
          - Address is wrong
          - Firewall is interferring.

          Your error report suggests that Eclipse itself is reporting the error, rather than a java problem. So an Eclipse forum might help.
          • 2. Re: Problem connecting to Mysql via Eclipse
            803795
            I'm not into threads, but I suspect creating 10 threads isn't really going to buy you anything. If anything, it may hurt performance (just guessing here). My reasoning is that if your CPU is mostly processing your one query nearly 100% of the time, its efficient. If it has 10 threads, each is only using about 10% of the CPU time, plus the performance hit in continually time slicing between the threads. However, if you can fetch data from the database (which takes time), while you are processing the current batch of records, that may save time.

            Best to run it late at night when few are using the computer.


            Also, be careful about your sql. Example:
            select * between 11/12/2010 and 11/22/2010
            Gets the records between the two dates inclusive(?).
            select * between 11/22/2010 and 11/25/2010
            also gets the records between the two dates inclusive(?).
            However, BOTH queries retrieve data from 11/22/2010(?) and therefore is redundant. The second sql should be
            select * between 11/23/2010 and 11/25/2010
            I'm not sure about this, but you might want to consider it.

            Also, using an end date of 11/31/2010 may not be valid since november doesnt have 31 days(?). Also, leap year is a problem.

            I think the better solution to this would be to have a version number (an integer or timestamp) in each record. Each time the record is updated, the version is updated. This way, you can compare version numbers rather than all fields which sould be faster. Similarly for delete and insert of new records.

            If you get the system time in milliseconds before an after any operation and print out their differences when running your code, you can do a performance check.
            • 3. Re: Problem connecting to Mysql via Eclipse
              jschellSomeoneStoleMyAlias
              njbt7y wrote:
              I'm not into threads, ...
              I suspect that is a good answer to some other question.