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

Quote

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).

Quote

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: http://p2p.wrox.com/servlets/85997-http-status-404-error-tomcat.html

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


Subject
Written By
Posted
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.