Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

whats wrong here in connection string

 
divya kundapur
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
divya kundapur
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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")+"");

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic