Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat - mysql : Connection refused

 
gianni ipez
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic