Bthunder
Bthunder

Reputation: 93

Problem connecting to remote mysql database

I am trying to connect to a mysql db on a shared server. I am using a java application to make the connection. Problem doesn't happen when I connect to localhost db.

URL = "jdbc:mysql://SHARED HOST IP:3306/DBNAME"; 
USER = "dbUSER"; 
PASS = "dbPASS"; 

Connection conn = DriverManager.getConnection(URL, USER, PASS); 

java.sql.SQLException: Access denied for user 'DBUSER'@'mycomputersIP???' (using password: YES)

It is strange that it says denied for dbuser@ mycomputersip instead of dbuser@sharedhostIP

Is there a setting on my wireless router that is screwing things up?

Upvotes: 2

Views: 1320

Answers (4)

TheLQ
TheLQ

Reputation: 15008

Just as VeeArr said, 'DBUSER'@'mycomputersIP???' is standard. For some reason your host exposes your database but isn't allowing you to connect. There's a way in phpMyAdmin to do it under Privileges if you manage the whole database or there's an option in your control panel. If not, then you need to contact your host for guidence

Upvotes: 0

gmhk
gmhk

Reputation: 15940

The Same problem I have got earlier, Its very simple, The access has been denied by your ISP to access DB,

Raise the request to grant access, it will work.

Upvotes: -1

nathan gonzalez
nathan gonzalez

Reputation: 11987

your database is not configured for remote access. basically its saying your user located at your ip doesn't have permission to access the database, as opposed to your user located at the web server.

if you are using a shared hosting package, you will either need to turn this on in your admin area, or it may not be supported by your host. some hosts additionally require that externally accessible databases may not be on the web server, so your connection string would likely change as well.

Upvotes: 2

VeeArr
VeeArr

Reputation: 6178

There are no settings screwed up on your router. If you are trying to connect from mycomputersIP (i.e. the program opening the JDBC connection is on your computer), then the database will need to grant permission to 'DBUSER'@'mycomputersIP'. (In fact, that is the point of that portion of the grant string.)

Upvotes: 0

Related Questions