Re: Can not connect to Mysql using jdbc on xp
Posted by: Tetsuro Ikeda
Date: May 31, 2005 01:29AM

Hi Naomi,

> cnn =
> DriverManager.getConnection("jdbc:mysql://127.0.0.
> 1/prayerdiary:3306?user=root&password=root");

This is wrong. Port number should be written after hostname and before database-name.

> cnn =
> DriverManager.getConnection("jdbc:mysql://127.0.0.
> 1:3306/prayerdiary?user=root&password=root");

And this is right.

> instead, but then I started getting:
> ***************************
> java.sql.SQLException: Unable to connect to any
> hosts due to exception:
> Connection refused: connect
> ...
> ***************************

The reason you got the error message above is your connection was
rejected by Server in authentication process.
Check the GRANT setting again, and you will solve.

If you couldn't find any mistakes in GRANT setting, check the general log file
so you can find that Java Program tried connecting by which username and
from which host in actually.

-- Tetsuro

Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.