|
|
| regarding jdbc |
Expert:tushar087
i am using this program
/* import java.sql.*;
public class JdbcExample1 {
public static void main(String args[]) { Connection con = null;
try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql:///test", "root", "tushar");
if(!con.isClosed()) System.out.println("Successfully connected to MySQL server...");
} catch(Exception e) { System.err.println("Exception: " + e.getMessage()); } finally { try { if(con != null) con.close(); } catch(SQLException e) {} } } } */ this program complies -no error but when run it give the following error Exception: Access denied for user 'root'@'localhost' (using password: YES) i am not able to solve the error please help |
| Answers |
Hi friend,
We check the your code it works properly but check the JDBC Connection Parameter "username" "password" of the database.
For more information on JDBC visit to :
http://www.roseindia.net/jdbc/jdbc-mysql/MysqlConnect.shtml
Thanks
|
Check ur password, might be it blank
or else open database use this alter user username identfied by tushar
bcoz default for mysql username : root Password: blank( no value)
Rajanikant
|
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|