You also need to configure an appropriate MySQL url. This has the format:
jdbc:mysql://<hostname>:<port number>/<database-name>
for example:
jdbc:mysql//localhost/testdb
- as the port number is optional.
In order for your Java application to connect to your MySQL you need some code which’ll look abit like this:
try {
Class.forName(driverName);
con = DriverManager.getConnection(url, userName, password);
} catch (SQLException e) {
No comments:
Post a comment