I am trying to connect a Java application to a SQL database that I set up on my local computer. There is no server so all of the answers im finding when trying to research it are not working or applicable. The error I get when I run this is:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Caused by: java.net.ConnectException: Connection refused: connect
I have verified the username and password for SQL and verified that the account has full admin rights. Any ideas? Im at a loss...
package database_console;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBConnect {
public static void main(String[] args) {
try{
String host= "jdbc:mysql://[myIPaddress]/MTGDatabase";
String uName = "Java";
String uPass = "pass";
Connection con = DriverManager.getConnection(host , uName, uPass );
}
catch(Exception e){
e.printStackTrace();
}
}
}