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...
SolangeRichardAsked:
Who is Participating?
 
hoomanvCommented:
MM.MySQL is no longer supported
use connector/j instead
http://dev.mysql.com/downloads/connector/j/3.1.html
0
 
CEHJCommented:
Make sure the right database is listening on the default port
0
 
SolangeRichardAuthor Commented:
Would you know what I have to change in my code to use connectors instead?
I've tried with no success
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
hoomanvCommented:
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql:///database", "user", "pass");
0
 
CEHJCommented:
>>to use connectors instead?

What do you mean by this?
0
 
hoomanvCommented:
which exception is thrown when you try to connect to DB
print stack trace here
0
 
SolangeRichardAuthor Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.