Hello I have this simple java code running in Eclipse in mac, just trying to connect to my google cloud database.
public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdb:mysql://XX.XXX.X.XXX/test","root","1234");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("select * from cars");
while(rs.next())
{
System.out.println(rs.getString(1));
}
connection.close();
}
}
The problem I have is that when I use the newInstance function, Eclipse crosses it out, and when I run my program I get the Error:
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdb:mysql://XX.XXX.X.XXX/test
Any help solving this issue would be greatly appreciated!