Hi, i have been banging my head into the wall with this so your help would be awesome! I am making an app that uses a MYSQL database so i am trying to connect to the database and it will not work. This might be more of a Java question, but it is for a Droid app so i am putting it here.
function in Worker class:
Code:
Connection connection = null;
public String connectToDB() {
String dbURL = "jdbc:mysql://localhost:3306/database";
String username = "root";
String password = "pass";
Class.forName("com.mysl.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(dbURL, username, password);
if(connection != null){
conResult = "connected";
}else{
conResult = "not connected";
}
return conResult;
}
Class that uses above code:
Code:
Worker dbWorker = new Worker();
String test = dbWorker.connectToDB();
Toast t = Toast.makeText(this, test, Toast.LENGTH_LONG);
t.show();
i am only showing the code that i think is relevant. i must be missing something

i keep getting the toast that says not connected
i did not add the try/catches to this post to keep it clean.
i am using eclipse
things i have tried:
- i have added the mysql connector to the library and set the path
- the file is copy to the /ext file and the /bin in my java file
- the firewall on port 3306 has been disabled
- my password is correct
Oh i also started using an older connector mysql-connector-java-3.0.17-ga because someone said that would make it work.