File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes tomcat - mysql : Connection refused Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat - mysql : Connection refused" Watch "tomcat - mysql : Connection refused" New topic
Author

tomcat - mysql : Connection refused

gianni ipez
Ranch Hand

Joined: Jan 02, 2007
Posts: 65
Hi all,
I am learning how to connect to mysql database through tomcat,
and I am experiencing a problem.
I have followed the instrunctions detailed in :
Apache Tomcat Faq Page
the problem is that invoking:
http://localhost:8080/DBTest/test.jsp

I get the page with output:
Results
Foo Not Connected
Bar -1

and also the error in the log:


As someone told I checked the ports on my machine, and I have correctly set up mysql on port 3306, tomcat on 8080.
I have a firewall(Sunbelt Kerio), but I've already disabled it.

Any idea please?
Thank you in advance.
Gianni
Juan Antonio Gomez Moriano
Greenhorn

Joined: Oct 27, 2007
Posts: 3
Is your mysql server running?

Seems that the port is not open, you can quickly check if the 3306 port is open by doing a telnet to it :

telnet localhost 3306
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

I like doing a netstat -a on windows. Tells me what ports close to the one I want are open as well.

Shoot us the file that has your connection information and maybe we can see an error.

-Cameron McKenzie
gianni ipez
Ranch Hand

Joined: Jan 02, 2007
Posts: 65
Thank you for your answers.
if I check mysql in the services running I can get it.
It says started.

here are the answers at the prompt commands:
>telnet localhost 3306:
L
6.0.2-alpha-community-nt-debug♥a]0stmGY,☻j*.Ha.a~x]K?

Connessione all'host perduta. (that means host connection lost)

when doing
>netstat -a:


Is there helpful?
Is this meaning something to you?
Thanks again!
Gianni
Taslim Sohel
Greenhorn

Joined: Jan 16, 2008
Posts: 1
I burned with the same problem for long time. I fixed that.
Just download the JTDS JDBC Driver and unpack it. Copy the jtds-1.2-dist.zip file that you download from Sourceforge in to %TOMCAT_HOME%/common/lib.

That�s all. Restart your Tomcat and try again.

JTDS JDBC Driver Download Link:
http://sourceforge.net/project/showfiles.php?group_id=33291
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat - mysql : Connection refused
 
Similar Threads
Tomcat fails to load: PeekInputStream.readFully
Connecting with MySql
java.net.ConnectException: Connection refused: MYSQL
Communication link failure: error when satarting tomcat
Catalina.stop: java.net.ConnectException: Connection refused: connect