jQuery in Action, 2nd edition
The moose likes JDBC and the fly likes Properties file for DB connection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Properties file for DB connection" Watch "Properties file for DB connection" New topic
Author

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: 36

''@'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
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

This has nothing to do with Struts; moving.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Properties file for DB connection
 
Similar Threads
Accessing variable from another method
how to upload pdf files to My sql with java
JDBC Exception in JNDI lookup
Help with this code!
jsp with servelet execution in tomcat