Java - trouble connecting to online MySQL database using JDBC?

I've had this problem too and it's always (in my case) been down to an incorrect jdbc url, e.g. Missing/wrong port number (i know your sample code has been editted but it doesn't specify any port) or incorrect ip address, failing that check that mysql is running and accepting connections on the port and ip you're expecting. Check the bind-address in your my. Cnf against the ip address in your jdbc url.

I'm not sure what (if any) port I should specify... The server I have is hosted on Godaddy.com, which is never easy to deal with – YoungMoney Aug 26 '11 at 23:18 the default port is 3306, so your jdbc url should be like jdbc:mysql://84.168.199.70:3306/my_db_name then as BalusC said remove the (Connection) casts. Quick google showed this, might help help.godaddy.com/article/262 – eon Aug 26 '11 at 23:27 thanks, but still no luck. The annoying thing is that a basic PHP script with the same IP/username/password works perfectly.Is Godaddy not allowing Java to have access or something?

– YoungMoney Aug 27 '11 at 0:28 if you are trying to connect to a mysql server at godaddy from your home pc it most likely won't work due to firewalls, for example I can't imagine port 3306 being accessible from the outside, so question is where is the client, inside godaddy network? Also you mention a PHP script that works, where is the PHP script running? – eon Aug 27 '11 at 0:35 I think I resolved the issue - see my answer below.

I'm not sure if that's the right answer or if I just got lucky, but it seems to have worked. – YoungMoney Aug 27 '11 at 0:45.

Answering my own question here, because the code I had was fine. The problem was with my Godaddy settings. Basically when you're making a MySQL database with these guys, make sure you have "Allow Direct Database Access" set to YES.

Apparently my other database wasn't. I'll still leave the question unanswered for a while in case other people have any input. These configuration things always get me...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions