I think you do not have access right to yourMySql instance .for example if you login to your os as login=fooand pass=par and then start mysql Server , thenyour connection String must be :jdbc:mysql://localhost:3306/dbname?user=foo&password=bar"