File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes  MySQL is driving me nuts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark " MySQL is driving me nuts" Watch " MySQL is driving me nuts" New topic

MySQL is driving me nuts

C. Magmanum
Ranch Hand

Joined: Apr 03, 2004
Posts: 35
I am new to SQL and I resently just installed MySQL server on my system. I also have Tomcat installed as my webserver.
This is my problem:

I keep getting this error when my JSP tries to connect to my database

Cannot connect to MySQL server on localhost:3307. Is there a MySQL server running on the machine/port you are trying to connect to?

Tomcat and MySQL both run on my machine!

and here is the java code in my JSP

Help please before I go insane, I've been on it for over 48 hours!
[ January 08, 2005: Message edited by: Bear Bibeault ]
Chris Montgomery
Ranch Hand

Joined: Jan 14, 2004
Posts: 141
isn't mysql on port 3306?
C. Magmanum
Ranch Hand

Joined: Apr 03, 2004
Posts: 35
I used port 3307 because I thought it was a problem with that port. Anyway, I have set everything back to default.
Now mysql is on port :3306 and my jsp refers to it on that same port but the problem still persists

I am using XP with service pack 2
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
How did you set up the 'register' database? Describe that in detail please.

What OS are you using, Windows or Unix?

-If Windows, make sure the Mysql NT service is started (control panel ...-> services)

-If Unix, make sure the Mysql daemons is up. Check it by:

ps -wf | grep -i mysql

pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547

- can you connect to localhost 3306 with telnet (to check if DB is up)
- try to replace localhost with or the machine name/ip ?
- do you have any software firewall which could cause this ?
- did you modify java's security settings to deny access (i swapped in the wrong policy file once and searched for the "bug" for a longlong time ;-) )

C. Magmanum
Ranch Hand

Joined: Apr 03, 2004
Posts: 35
its working now! Thanks all. very much appreciated.
Sabari Girish

Joined: Jan 13, 2005
Posts: 2
HI all,

I am also facing the same problem. Please let me know also how u solved the problem please.

Thanking u,
Paymon Asadinia

Joined: Jan 11, 2005
Posts: 8

have you guys put all this information in the tomcat config file yet,
like the jdbc driver, name of your database, etc? I didn't seem to notice in your posts that, this was mentioned. just a thought


Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33132

"schrodinger's cat",
We're pleased to have you here with us in the JDBC forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Forum Bartender

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Andreas Andersson

Joined: Jan 18, 2005
Posts: 1
I have the same problem. Here is the answere to most of the previous questions:

Yes, I can connect from prompt without problems
No, I can't connect via telnet (should that be possible?), not even from the localhost (tryed ip, hostname and localhost)
No, I can't connect from mysqlCC from another machine.

The daemon is running (otherwise I wouldn't be able to connect at all and I am).

Any ideas?
I agree. Here's the link:
subject: MySQL is driving me nuts
It's not a secret anymore!