So I'm trying to connect to my MySQL database hosted by AWS with Java so I can add some of my own modules but I'm having issues with the driver. I got the code from a guide online and have tried to fix it with imports, but the issue i'm getting from eclipse is: Got an exception! No suitable driver found for jdbc:sqlserver://ls-303a92f8cfd2da433af284eee07a1052317e9e14.c7xhy47efuuf.ca-central-1.rds.amazonaws.com
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.*;
import com.mysql.*;
import java.util.*;
public class JavaMysqlPreparedStatementInsertExample
{
public static void main(String[] args)
{
try
{
// create a mysql database connection
String myDriver = "com.mysql.cj.jdbc.Driver";
String myUrl = "ls-303a92f8cfd2da433af284eee07a1052317e9e14.c7xhy47efuuf.ca-central-1.rds.amazonaws.com";
Class.forName(myDriver);
Connection conn = DriverManager.getConnection(myUrl, "user", "mypassword");
// create a sql date object so we can use it in our INSERT statement
Calendar calendar = Calendar.getInstance();
java.sql.Date startDate = new java.sql.Date(calendar.getTime().getTime());
// the mysql insert statement
String query = " insert into users (first_name, last_name, date_created, is_admin, num_points)"
+ " values (?, ?, ?, ?, ?)";
// create the mysql insert preparedstatement
PreparedStatement preparedStmt = conn.prepareStatement(query);
preparedStmt.setString (1, "Barney");
preparedStmt.setString (2, "Rubble");
preparedStmt.setDate (3, startDate);
preparedStmt.setBoolean(4, false);
preparedStmt.setInt (5, 5000);
// execute the preparedstatement
preparedStmt.execute();
conn.close();
}
catch (Exception e)
{
System.err.println("Got an exception!");
System.err.println(e.getMessage());
}
}
}