I am trying to connect to a mysql database which i have hosted on a web host instead of localhost using java. i have included the mysql-connector in the java build path of the project. i have the following code:
package com;
import java.sql.*;
public class Retrieve{
public static void main(String[] args) throws InstantiationException, IllegalAccessException
{
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
String host = "mysql4.000webhost.com/a6136644_bustrac";
String user = "";
String password = "";
Connection conn = null;
try {
conn = DriverManager.getConnection(host, user, password);
if(conn != null)
{
System.out.println("Connection Successfull");
}
}
catch (SQLException e)
{
System.out.println(e.getMessage());
System.exit(0);
}
}
}
I am not getting any error, but when i run the program, i get:
No suitable driver found for mysql4.000webhost.com/a6136644_bustrac
what can be the issue?
EDIT: the a6136644_bustrac in the host url refers to the database