*
The moose likes JDBC and the fly likes whats wrong here in connection string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "whats wrong here in connection string" Watch "whats wrong here in connection string" New topic
Author

whats wrong here in connection string

divya kundapur
Ranch Hand

Joined: Aug 21, 2007
Posts: 110
Hi,

I'm getting this error --- java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)



Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+ prop.getProperty("DATABASE_SERVER_NAME")+","+prop.getProperty("DATABASE_SERVER_USERNAME") +","+ prop.getProperty("DATABASE_SERVER_PASSWORD")+"");

when i use system.out it prints out this

-- jdbc:mysql://localhost:3306/auto_mail,root,root123


SCJP - 5.0
divya kundapur
Ranch Hand

Joined: Aug 21, 2007
Posts: 110
I solved it , changed a little bit



Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+ prop.getProperty("DATABASE_SERVER_NAME")+"?user="+prop.getProperty("DATABASE_SERVER_USERNAME") +"&password="+ prop.getProperty("DATABASE_SERVER_PASSWORD")+"");

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: whats wrong here in connection string