• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat and MySQL

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Hopefully this is the right place to post this question.

I'm having difficulty getting my webapp connecting to the mysql server running locally.

If I write a simple Java application and do some sql through JDBC it works fine; connecting to, querying and receiving results from the database.

As soon as I try to do the same in a webapp thats deployed in tomcat (locally) I get the following error,

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

Why is this happening? I know all the connection parameters are correct. As far as I'm aware there's no firewall blocking or anything going on.

I'm using eclipse on Vista x64 with tomcat 6.0.18 with mysql 5.0.67 x64(if that helps).

I vaguely remember setting this all up on an xp box and it just working, so I'm guessing this might be a vista thing.

Any help would be appreciated, I seem to have hit a dead end on this one.

Regards,

Bobby
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried using google? I found this by searching on the exception name. http://forums.mysql.com/read.php?39,181940,226710#msg-226710
 
Daniel Jackson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I have.

I've read several articles about this error occuring for slow queries and things to do with connection pooling.

My problem has nothing to do with those. It's a simple connect to database, run query, process resultset. Nothing fancy with threads or anything, very simple table as well. The webapp is very basic.

The article you linked to suggests Tomcat does connect to mySQL but loses it later on when the queries get slow. For me tomcat doesn't connect to mySQL at all, just throws the error I mentioned. But a standalone java app can use the database with no problems. My guess is tomcat is being silly somewhere, I just don't know where.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Bobby Islam" Please check your private messages for an important administrative matter.
 
reply
    Bookmark Topic Watch Topic
  • New Topic