I have a virtual webserver hosted with GoDaddy and I have configured my webserver with an ssl. The webserver is also setup as a subdomain. I have also created a MySQL database and given remote access to the database. I have confirmed all of my ssl, subdomain, and MySQL settings with GoDaddy support and they have confirmed that the settings are correct.
Now, I am trying to connect my Java application to the MySQL database. I have done this before on a shared server hosted with Cpanel, but I have not been able to connect via an ssl on my new virtual server. I had to purchase the virtual webserver to get the ssl to work correctly (Says GoDaddy). I am using JDBC. Here is my code, but I need help with the code so that I can connect to the database with an ssl connection. I have done some research, but all of the different codes I try always result in an error. I appreciate the help! Also, GoDaddy says that port 3306 is opened by default when you create the database with remote access. I have done this.
Here is my code....
public class FTSDB {
//JDBC driver name and database URL
public static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
public static final String DB_URL = "jdbc:mysql://databases.ftstoo.com:3306/MyDatabase?useSSL=true\";"; public static final String DB_NAME = "MyDatabase";
//Database credentials
public static final String USER = "USERNAME";
public static final String PASS = "PASSWORD";
public static void init(){
try{
Class.forName(JDBC_DRIVER);
Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
conn.close();
createTable();
GUI.start();
}catch(Exception e){
e.printStackTrace();
System.out.println(e.getMessage());
}
}
Aucun commentaire:
Enregistrer un commentaire