File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes Properties file for DB connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Properties file for DB connection" Watch "Properties file for DB connection" New topic

Properties file for DB connection

Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
Hi all, I would like to use properties file to create connection to my mysql DB

My properties file

My Class file

Please let me know what the mistake is. I am getting an error like java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)

Thank you in advance
Karthik Jayachandran
Ranch Hand

Joined: Feb 18, 2009
Posts: 88

''@'localhost' (using password: YES)

You can see it is not getting the username and password

Have the url only separately.

And then add two more properties as,

It might work.
David Newton

Joined: Sep 29, 2008
Posts: 12617

This has nothing to do with Struts; moving.
jQuery in Action, 2nd edition
subject: Properties file for DB connection