Link to home
Start Free TrialLog in
Avatar of SolangeRichard
SolangeRichardFlag for Canada

asked on

MySql server upgrade from 4.0 to 5.0 jdbc will not connect anymore.

This is working as long as MySql 4.0 is on the server but not if MySql 5.0 is there.

mm.mysql-2.0-bin.jar is used

public class Data {
   static Connection c;
   private String connectString = "jdbc:mysql://ipAdress/databaseName?user=userLogin&password=userPassord";
   private int attempts, limit = 2;

      public Data() {
            try  {
                  Class.forName("org.gjt.mm.mysql.Driver").newInstance();
            } catch (Exception e) {
                  e.printStackTrace();
            }
            while ((c==null) && (attempts<limit)) {
                  attempts++;
                  try {
                        c = DriverManager.getConnection(connectString);
                  } catch (Exception e) {
                        e.printStackTrace();
                  }
            }
      }

// more code...
ASKER CERTIFIED SOLUTION
Avatar of hoomanv
hoomanv
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Make sure the right database is listening on the default port
Avatar of SolangeRichard

ASKER

Would you know what I have to change in my code to use connectors instead?
I've tried with no success
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>to use connectors instead?

What do you mean by this?
which exception is thrown when you try to connect to DB
print stack trace here
Oups I did not change this line :
Class.forName("org.gjt.mm.mysql.Driver").newInstance();

to this one...
Class.forName("com.mysql.jdbc.Driver").newInstance();

This is why I wasnt able to make it work!

Thank you hoomany.