• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

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...
0
SolangeRichard
Asked:
SolangeRichard
  • 3
  • 2
  • 2
2 Solutions
 
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now