2

i have to try creating connection class using java to connect with mongoDB database, everything seems okay, but i always get authenticate error message

this the error line

boolean auth = db.authenticate("aku", "kamu".toCharArray());

enter image description here

beboy
  • 105
  • 1
  • 12
  • any solutions guys? – beboy Jun 28 '16 at 03:52
  • check your project setup, it show that you IDE did not find the symbol, means some jar is missing, if jar is their, than it is not avalabe to IDE. – ankush yadav Jun 28 '16 at 04:02
  • can you give me link to download that jar you have on your pc? i'll try to using another jar.. if its still failed, can you suggest me another IDE to compile java application and java web? – beboy Jun 28 '16 at 04:11
  • Possible duplicate of [How can I authenticate any database with given username and password in Mongo Java Driver 2.13.0?](http://stackoverflow.com/questions/29343795/how-can-i-authenticate-any-database-with-given-username-and-password-in-mongo-ja) – shmosel Jun 28 '16 at 04:13
  • i am newbie on mongoDB, i cant understand what is credential, can u make it clear? – beboy Jun 28 '16 at 04:27

1 Answers1

2

Please check whether you are using MongoDB 2.X or 3.X driver.

The API DB.authenticate(String username, char[] passwd) is no longer exists in 3.X driver. Please see http://mongodb.github.io/mongo-java-driver/3.2/driver/reference/connecting/authenticating/ on how to authenticate with the 3.X driver.

Wilson
  • 11,339
  • 2
  • 29
  • 33