Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Authorization failing. Java driver expects char array for password. #5

merged 1 commit into from

4 participants


The Java driver expects the password passed to it for database authorization to be a char array. Fixed those methods which call the Java driver directly.


I am happy to merge this.

Are you using jmongo in production? I ask because we are thinking of ceasing maintenance of jmongo.

Thanks for the fix; I ran into this one.
One thing you might consider in lib/mongo/db.rb...

        succeeded = @j_db.authenticate(username, password)
        if save_auth && succeeded
          @connection.add_auth(@name, username, password)
      rescue => e
        succeeded = false

The exception is eaten; this made it hard for me to find out the problem because it silently returns false. You might let the exception throw out instead.

Are you using jmongo in production?

I am considering retiring this library because I have switched to Moped (from the Mongoid guys.) Have you looked at Moped?


@seanpd I'm using Moped in production as well. @guyboertje had asked if I wanted to take over maintenance of this library, but since choosing Moped that's not really feasible. I vote for lib-retirement. Thanks @guyboertje for the work you put into this.


I'm actually working with @jacaetevha on the same project. But now we're considering whether to use other jruby-compatible drivers since you're thinking of ceasing maintenance.

@guyboertje guyboertje merged commit 0dcb979 into guyboertje:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 9, 2012
  1. @marclove
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/jmongo/db.rb
4 lib/jmongo/db.rb
@@ -47,7 +47,7 @@ def initialize(db_name, connection, options={})
def authenticate(username, password, save_auth=true)
- succeeded = @j_db.authenticate(username, password)
+ succeeded = @j_db.authenticate(username,
if save_auth && succeeded
@connection.add_auth(@name, username, password)
@@ -58,7 +58,7 @@ def authenticate(username, password, save_auth=true)
def add_user(username, password)
- @j_db.add_user(username, password)
+ @j_db.add_user(username,
def remove_user(username)
Something went wrong with that request. Please try again.