473,408 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

A simple thing!

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?user=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(Stand ardSocketFactory.java:143)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:225)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:1805)
at com.mysql.jdbc.Connection.<init>(Connection.java:4 52)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:411)
at java.sql.DriverManager.getConnection(DriverManager .java:525)
at java.sql.DriverManager.getConnection(DriverManager .java:193)
at MySqlDB.<init>(Unknown Source)
at UserActions.<init>(Unknown Source)
at UserButtonHandler.<init>(Unknown Source)
at UserDataPanel.<init>(Unknown Source)
at PainFull.<init>(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

Jan 30 '06 #1
2 5901
"Doug" <dk*****@XXXtelus.planet.net> wrote in message
news:pa****************************@XXXtelus.plane t.net...
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost/ARPWS?user=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.
Jan 31 '06 #2
On Mon, 30 Jan 2006 17:27:36 -0800, Bill Karwin wrote:
"Doug" <dk*****@XXXtelus.planet.net> wrote in message
news:pa****************************@XXXtelus.plane t.net...
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost/ARPWS?user=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

Feb 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Brian Sabbey | last post by:
Here is a first draft of a PEP for thunks. Please let me know what you think. If there is a positive response, I will create a real PEP. I made a patch that implements thunks as described here....
5
by: Ryan Waye | last post by:
I have looked extensively, and I have been unable to find commands that allow a C++ program to manipulate other files. How do I make C++ do simple things like copy and past files, and navigate...
2
by: megandelune | last post by:
I have been learning ASP from a book I bought a week ago and so far it is very informative, but I seem to be confused on one simple term. Variant. Now I learned how to declare a varible with the...
51
by: Alan | last post by:
hi all, I want to define a constant length string, say 4 then in a function at some time, I want to set the string to a constant value, say a below is my code but it fails what is the correct...
3
by: Geoff | last post by:
Hi, all, I have a VB .NET (VS 2003) application that has a dropdown list or dropdown combo with checkboxes as a "3rd party control" linked to a ComponentOne TrueDBGrid cell button click event. ...
14
by: robert | last post by:
For testing purposes I'm looking for a simple DAV server - best a python thing serving a folder tree. Don't want to install/change/setup the complex apache dav .. Found PyDav...
18
by: Bob Cummings | last post by:
Not sure if this is the correct place or not. Anyhow in school we were taught that when trying to calculate the efficiency of an algorithm to focus on something called FLOPs or Floating Point...
3
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml...
2
by: Michael7 | last post by:
Hi everyone, I'm new to CSS of course, and have been trying to learn it. However, when I try to pull off something as simple as positioning of text . . . nothing works in my index page. So in...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.