SolangeRichard
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/dat abaseName? user=userL ogin&passw ord=userPa ssord";
private int attempts, limit = 2;
public Data() {
try {
Class.forName("org.gjt.mm. mysql.Driv er").newIn stance();
} catch (Exception e) {
e.printStackTrace();
}
while ((c==null) && (attempts<limit)) {
attempts++;
try {
c = DriverManager.getConnectio n(connectS tring);
} catch (Exception e) {
e.printStackTrace();
}
}
}
// more code...
mm.mysql-2.0-bin.jar is used
public class Data {
static Connection c;
private String connectString = "jdbc:mysql://ipAdress/dat
private int attempts, limit = 2;
public Data() {
try {
Class.forName("org.gjt.mm.
} catch (Exception e) {
e.printStackTrace();
}
while ((c==null) && (attempts<limit)) {
attempts++;
try {
c = DriverManager.getConnectio
} catch (Exception e) {
e.printStackTrace();
}
}
}
// more code...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Make sure the right database is listening on the default port
ASKER
Would you know what I have to change in my code to use connectors instead?
I've tried with no success
I've tried with no success
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>to use connectors instead?
What do you mean by this?
What do you mean by this?
which exception is thrown when you try to connect to DB
print stack trace here
print stack trace here
ASKER
Oups I did not change this line :
Class.forName("org.gjt.mm. mysql.Driv er").newIn stance();
to this one...
Class.forName("com.mysql.j dbc.Driver ").newInst ance();
This is why I wasnt able to make it work!
Thank you hoomany.
Class.forName("org.gjt.mm.
to this one...
Class.forName("com.mysql.j
This is why I wasnt able to make it work!
Thank you hoomany.