Re: connect to MYSQL with servlet
Posted by: Phillip Ward
Date: July 10, 2013 05:37AM


My database is called db, and in my database i made two tables: username, and password.
No, you didn't.
In your database called db you created a table called "Login" containing two columns called `username` and `password`.
(For the moment, I'm going to ignore the likelihood that you're holding passwords in plain text, which is a horribly, horribly Bad Idea).


So when I run this servlet I get a 404 error.
That's not a database error.
I suspect your servlet configuration or URL are incorrect, something like this:

Make sure that you can connect to your database using your chosen credentials using the mysql command line program.

And then stop connecting your application to your database as root - no application should ever need to do so; it's another really horrible security vulnerability. Set up "application" accounts that make the database connection (and which also means that you don't have to manage individual user permissions at the database level).

Regards, Phill W.

Options: ReplyQuote

Written By
Re: connect to MYSQL with servlet
July 10, 2013 05:37AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.