1) This code should not be in a scriptlet. Move the query part out to a bean.
2) Use a connection pool, or open the connection in a session object (although this type of persistence is frowned upon) because opening a connection for every page load is extremely inefficient.
3) if you absolutely must use scriptlets (which you don't, but you may insist on it) then at least don't mix "html tag" strings into the middle of the scriptlet, that is just blurring the separation (and increasing the maintenance load) all that much more.
4) The user would generally be simply "root", as opposed to "root@localhost". The MySQL server will resolve the "@whatever" part itself, depending on where you connect from. Make sure you have the user@whatever login allowed over TCP in your MySQL configuration.
I think those are enough problems for now.
Last edited by masijade : Oct 15th, 2007 at 9:59 am. Reason: typo
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan