wood burning stoves 2.0*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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.
I agree. Here's the link: http://aspose.com/file-tools
subject: Properties file for DB connection
Similar Threads
Accessing variable from another method
JDBC Exception in JNDI lookup
how to upload pdf files to My sql with java
jsp with servelet execution in tomcat
Help with this code!