A simple thing!
am 31.01.2006 00:25:01 von Doug
Hello
It has been some years since I used Mysql. How
could I forget so much?!
I can connect to my (4.x-Connector/J 3.0.17-ga) (using password
123456) test db with:
mysql -u dkr -h localhost -p ARPWS
I cannot create a connection with:
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost/ARPWS?us er=dkr&password=123456");
The runtime returns an exception:
java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.SocketException: java.net.ConnectException: Connection refused
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused
STACKTRACE:
java.net.SocketException: java.net.ConnectException: Connection refused
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketF actory.java:143)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:225)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1805)
at com.mysql.jdbc.Connection.(Connection.java:452)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDr iver.java:411)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at MySqlDB.(Unknown Source)
at UserActions.(Unknown Source)
at UserButtonHandler.(Unknown Source)
at UserDataPanel.(Unknown Source)
at PainFull.(Unknown Source)
at Main.init(Unknown Source)
at Main.main(Unknown Source)
class 'com.mysql.jdbc.Driver' not found java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.SocketException: java.net.ConnectException: Connection refused
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused
OK - I'm getting old. What have I forgotten this time?
Thank you for your time!
dkr
Re: A simple thing!
am 31.01.2006 02:27:36 von Bill Karwin
"Doug" wrote in message
news:pan.2006.01.30.23.24.59.784424@XXXtelus.planet.net...
> Connection conn =
> DriverManager.getConnection("jdbc:mysql://localhost/ARPWS?us er=dkr&password=123456");
>
> The runtime returns an exception:
> java.sql.SQLException: Unable to connect to any hosts due to exception:
> java.net.SocketException: java.net.ConnectException: Connection refused
Frequently I see the JDBC getConnection using the three-String method
signature, for example:
DriverManager.getConnection("jdbc:mysql://localhost/ARPWS", "dkr",
"123456");
Even though javax.sql.DriverManager includes a single-String method
signature for getConnection, and the MySQL Connector/J docs imply your usage
should work, it seems folks don't use that form much. Searching Koders.com,
I see only usage of the three-String method signature, for MySQL connections
(and also for other RDBMS brands)
Regards,
Bill K.
Re: A simple thing!
am 01.02.2006 01:22:45 von Doug
On Mon, 30 Jan 2006 17:27:36 -0800, Bill Karwin wrote:
> "Doug" wrote in message
> news:pan.2006.01.30.23.24.59.784424@XXXtelus.planet.net...
>> Connection conn =
>> DriverManager.getConnection("jdbc:mysql://localhost/ARPWS?us er=dkr&password=123456");
>>
>> The runtime returns an exception:
>> java.sql.SQLException: Unable to connect to any hosts due to exception:
>> java.net.SocketException: java.net.ConnectException: Connection refused
>
> Frequently I see the JDBC getConnection using the three-String method
> signature, for example:
>
> DriverManager.getConnection("jdbc:mysql://localhost/ARPWS", "dkr",
> "123456");
>
> Even though javax.sql.DriverManager includes a single-String method
> signature for getConnection, and the MySQL Connector/J docs imply your usage
> should work, it seems folks don't use that form much. Searching Koders.com,
> I see only usage of the three-String method signature, for MySQL connections
> (and also for other RDBMS brands)
>
> Regards,
> Bill K.
Thanks for the advice - I will give it a try as soon as I can!
dkr