Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySQL is driving me nuts

 
C. Magmanum
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
isn't mysql on port 3306?
 
C. Magmanum
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Guy
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi


- can you connect to localhost 3306 with telnet (to check if DB is up)
- try to replace localhost with 127.0.0.1 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 ;-) )


pascal
 
C. Magmanum
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its working now! Thanks all. very much appreciated.
 
Sabari Girish
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI all,

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

Thanking u,
Sabari
 
Paymon Asadinia
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

SCJP, SCWCD, SCBCD(In Progress)


 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.

Thanks,
Jeanne
Forum Bartender
 
Andreas Andersson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic