Online MySQL database gives "java.sql.SQLException: Access denied" -


i creating swing application in eclipse, need have access online mysql database. followed this link allows me build database in phpmyadmin.

i made database , trying connect through application, error :

java.sql.sqlexception: access denied user 'id148583_test_database'@'localhost' (using password: yes)

at com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:996) @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:3887) @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:3823) @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:870) @ com.mysql.jdbc.mysqlio.proceedhandshakewithpluggableauthentication(mysqlio.java:1659) @ com.mysql.jdbc.mysqlio.dohandshake(mysqlio.java:1206) @ com.mysql.jdbc.connectionimpl.coreconnect(connectionimpl.java:2234) @ com.mysql.jdbc.connectionimpl.connectonetryonly(connectionimpl.java:2265) @ com.mysql.jdbc.connectionimpl.createnewio(connectionimpl.java:2064) @ com.mysql.jdbc.connectionimpl.(connectionimpl.java:790) @ com.mysql.jdbc.jdbc4connection.(jdbc4connection.java:44) @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) @ java.lang.reflect.constructor.newinstance(constructor.java:408) @ com.mysql.jdbc.util.handlenewinstance(util.java:377) @ com.mysql.jdbc.connectionimpl.getinstance(connectionimpl.java:395) @ com.mysql.jdbc.nonregisteringdriver.connect(nonregisteringdriver.java:325) @ java.sql.drivermanager.getconnection(drivermanager.java:664) @ java.sql.drivermanager.getconnection(drivermanager.java:247) @ main.readproperties.(readproperties.java:40) @ main.mainclass.main(mainclass.java:17)

here code :

mainclass.java

package main;  import java.sql.connection; import gui.guiframe; import java.sql.drivermanager; import java.sql.sqlexception; import java.util.scanner; import javax.xml.ws.endpoint;  public class mainclass {       public static void main(string[] args) {           readproperties prop = new readproperties("connectionprops.properties");              connection conn = prop.getconnection();       }  } 

readproperties.java

package main;  import java.io.fileinputstream; import java.io.ioexception; import java.io.inputstream; import java.sql.connection; import java.sql.drivermanager; import java.sql.sqlexception; import java.util.properties;  public class readproperties {      private string db_user;     private string db_password;     private string db_driver;     private string db_connection;      private connection connection;      public readproperties(string filename){         properties propfile = new properties();         inputstream input = null;         try {             input = new fileinputstream(filename);             propfile.load(input);              db_user = propfile.getproperty("db_user");             db_password = propfile.getproperty("db_password");             db_driver = propfile.getproperty("db_driver");             db_connection = propfile.getproperty("db_connection");              connection = drivermanager.getconnection( db_connection, db_user, db_password);         } catch (ioexception | sqlexception ex) {             ex.printstacktrace();         }          {             if (input != null) {                 try {                     input.close();                 } catch (ioexception e) {                     e.printstacktrace();                 }             }         }     }      public connection getconnection() {         return connection;     } } 

and properties file :

db_user=id148583_test_database db_password=test_pass db_driver=com.mysql.jdbc.driver db_connection=jdbc:mysql://127.0.0.1:3306/id148583_test_database 

i set on own username , password. have mysqlconnector jar added. wrong? can't connect online database way?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -