java - Unable to Connect with my Database 000webhost.com -
try { string connectionurl = "jdbc:mysql://sql4.000webhost.com/a7291194_xxx"; connection connection = null; class.forname("com.mysql.jdbc.driver").newinstance(); connection = drivermanager.getconnection(connectionurl, "a7291194_xxx", "xxx"); if(!connection.isclosed()) system.out.println("successfully connected " + "mysql server using tcp/ip..."); connection.close(); }catch(exception ex){ system.out.println("unable connect database"+ex); }
with following connector code trying connect database on 000webhost.com gives me error:
communicationsexception: communications link failure last packet sent server 0 milliseconds ago. driver has not received packets server.
i trying best first time totally new webhosting please me in advance!
its same either on local or on server
class.forname("com.mysql.jdbc.driver"); connection connection = drivermanager.getconnection("jdbc:mysql://domainname or ip:3306/databasename", "username", "password");
Comments
Post a Comment