PDA

View Full Version : Java with MySQL


FuZion
02-14-2009, 07:41 PM
Hi there,

I have a Java program that connects to a MySQL database, and I have one quick question about it. My server information is stored within a separate static class that is referenced when needed. When I compile these and combine them into a JAR, is my database information safe? If not, how do I keep it secure?

Thanks!

FuZion

servlet
02-16-2009, 06:55 AM
Does that mean, user name/password are static variables?

FuZion
02-16-2009, 02:49 PM
Yup they're all static

servlet
02-17-2009, 05:59 AM
If the JAR isn't delivered outside then it's okey, not a big issue.

Best practice: you should keep the username/password in a configuration file (xml, properties) so changing it don't require recompile.