Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Facilite-GB
Contributor II
Contributor II

Mongodb blank database Issue

Hi,

 

I have an issue while creation a mongodb connection, when I leave "Database" field blank, I get this message:

Connection failed!
  org.talend.repository.nosql.exceptions.NoSQLServerException: Cannot connect to database!
      at org.talend.repository.nosql.db.util.mongodb.MongoDBConnectionUtil.checkConnection(MongoDBConnectionUtil.java:67)
      at org.talend.repository.nosql.db.provider.mongodb.MongoDBMetadataProvider.checkConnection(MongoDBMetadataProvider.java:153)
      at org.talend.repository.nosql.ui.common.AbstractNoSQLConnForm$1.widgetSelected(AbstractNoSQLConnForm.java:141)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
      at org.eclipse.jface.window.Window.runEventLoop(Window.java:832)
      at org.eclipse.jface.window.Window.open(Window.java:808)
      at org.talend.repository.nosql.action.CreateNoSQLConnectionAction.doRun(CreateNoSQLConnectionAction.java:91)
      at org.talend.repository.ui.actions.AContextualAction$2.run(AContextualAction.java:632)
      at org.talend.repository.RepositoryWorkUnit.executeRun(RepositoryWorkUnit.java:99)
      at org.talend.core.repository.model.AbstractRepositoryFactory.executeRepositoryWorkUnit(AbstractRepositoryFactory.java:258)
      at org.talend.repository.localprovider.model.LocalRepositoryFactory.executeRepositoryWorkUnit(LocalRepositoryFactory.java:3369)
      at org.talend.repository.gitprovider.core.GitRepositoryFactory.executeRepositoryWorkUnit(GitRepositoryFactory.java:369)
      at org.talend.repository.remoteprovider.RemoteRepositoryFactory.executeRepositoryWorkUnit(RemoteRepositoryFactory.java:850)
      at org.talend.core.repository.model.ProxyRepositoryFactory.executeRepositoryWorkUnit(ProxyRepositoryFactory.java:2119)
      at org.talend.repository.ui.actions.AContextualAction.run(AContextualAction.java:641)
      at org.talend.repository.viewer.action.RepoDoubleClickAction.run(RepoDoubleClickAction.java:117)
      at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:229)
      at org.eclipse.ui.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:185)
      at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
      at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:853)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
      at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
      at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:850)
      at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1142)
      at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:462)
      at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1249)
      at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:278)
      at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:272)
      at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:313)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
      at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
      at org.talend.rcp.intro.Application.start(Application.java:255)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
  Caused by: org.talend.repository.nosql.exceptions.NoSQLServerException: org.talend.repository.nosql.exceptions.NoSQLReflectionException: com.mongodb.CommandFailureException: { "serverUsed" : "******" , "ok" : 0.0 , "errmsg" : "not authorized on admin to execute command { listDatabases: 1 }" , "code" : 13 , "codeName" : "Unauthorized"}
      at org.talend.repository.nosql.db.util.mongodb.MongoDBConnectionUtil.getDatabaseNames(MongoDBConnectionUtil.java:169)
      at org.talend.repository.nosql.db.util.mongodb.MongoDBConnectionUtil.checkConnection(MongoDBConnectionUtil.java:48)
      ... 60 more
  Caused by: org.talend.repository.nosql.exceptions.NoSQLReflectionException: com.mongodb.CommandFailureException: { "serverUsed" : "*******" , "ok" : 0.0 , "errmsg" : "not authorized on admin to execute command { listDatabases: 1 }" , "code" : 13 , "codeName" : "Unauthorized"}
      at org.talend.repository.nosql.reflection.NoSQLReflection$WrapException.wrap(NoSQLReflection.java:97)
      at org.talend.repository.nosql.reflection.NoSQLReflection.invokeMethod(NoSQLReflection.java:68)
      at org.talend.repository.nosql.reflection.NoSQLReflection.invokeMethod(NoSQLReflection.java:53)
      at org.talend.repository.nosql.db.util.mongodb.MongoDBConnectionUtil.getDatabaseNames(MongoDBConnectionUtil.java:167)
      ... 61 more
  Caused by: com.mongodb.CommandFailureException: { "serverUsed" : "*******" , "ok" : 0.0 , "errmsg" : "not authorized on admin to execute command { listDatabases: 1 }" , "code" : 13 , "codeName" : "Unauthorized"}
      at com.mongodb.CommandResult.getException(CommandResult.java:76)
      at com.mongodb.CommandResult.throwOnError(CommandResult.java:140)
      at com.mongodb.Mongo.getDatabaseNames(Mongo.java:374)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.talend.core.utils.ReflectionUtils.invokeMethod(ReflectionUtils.java:166)
      at org.talend.repository.nosql.reflection.NoSQLReflection$3.toDo(NoSQLReflection.java:63)
      at org.talend.repository.nosql.reflection.NoSQLReflection$WrapException.wrap(NoSQLReflection.java:95)
      ... 64 more

But if I put "admin" as database, the connection check is successful.

0683p000009Lzwr.png0683p000009Lzza.png

 

I am using talend 6.4 and I need to read data from other databases in this mongodb instances.

 

Thanks in advance,

Nader

Labels (3)
4 Replies
fdenis
Master
Master

why don't you connect to an instance name?
Facilite-GB
Contributor II
Contributor II
Author

Hello,

Thank you for your reply.

Actually I need a generic connection that allows to access to all dbs in that server.

the error that talend show:

db.adminCommand( { listDatabases: 1 } );

{ "serverUsed" : "*******" , "ok" : 0.0 , "errmsg" : "not authorized on admin to execute command { listDatabases: 1 }" , "code" : 13 , "codeName" : "Unauthorized"}

 

But when I access to the server with robot 3T, I can execute the command: listDatabases on the database with the same user successfully as shows the attachement capture


mongo robot 3T.PNG
fdenis
Master
Master

if you look at mogodb command help:
https://docs.mongodb.com/manual/reference/method/db.adminCommand/
db.adminCommand run a comand as admin
the error explain "not authorized on admin to execute command "
your user is not authorised to use ListDatabase.
sometime low level editor allow mor than other.

if you have multiples db use multiple connections (useful if one connection is going to change)
if you still whant to use only one you must check authorisations.
good luck

Facilite-GB
Contributor II
Contributor II
Author

Thank you François,

 

I checked with our mongodb DBA and he told me that the used username has the necessary privileges to execute this command, I also tried it on mongo shell, and it gives me it supposed to.

So I really don't know how to do it!

I need at least a way to retrieve data from database other than the authentification one.