cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New

Error Establishing a Database Connection

i m building a java based program within eclipse environment and using jdbc to establish a connection.

a.t.m it works fine with the local database (mySQL workbench6.3CE)

yet when i try to create a connection to the goDaddy DB i get an error

 

"Exception in thread "main" java.sql.SQLException: Access denied for user 'userName'@'bzq-some number.cablep.bezeqint.net' (using password: YES)"

 

the format i use to establish connections

 

 

Class.forName("com.mysql.jdbc.Driver");

for (int i = 0; i < max_Con; i++)
{
Connection con = DriverManager.getConnection(conUrl,userName,pw);
conSet.add(con);
}

where:

conUrl is a string : "jdbc:mysql://" + IP +"/DBname" 

userName is of a user for the specific DB and has full privileges and pw is its password

 

P.S. my friend uses php format and gained an access to the database

does anyone encountered this problem and has an answer?

 

1 REPLY 1
Employee
Employee

Re: Error Establishing a Database Connection

What type of hosting are you using?

I'm going to assume cPanel. You have to whitelist your IP address in remote SQL to access the database externally.