B4J Question Connecting to Mongodb

lucdrb

Active Member
Licensed User
Longtime User
Hi,

I'm learning how to use a MongoDb Database and I've a problem with the connection, I've change the URI adress of the MongoDbAlexa for example
B4X:
    mongo.Initialize("", "mongodb://192.168.0.33:27017")
    db = mongo.GetDatabase("sites")
    ranks = db.GetCollection("ranks")

and I got this error message


Do I miss something in the connection string?
The MongoDB is installed on a Ubuntu Linux computer.

Luc
 

OliverA

Expert
Licensed User
Longtime User
Or it may be a port issue due to this:
Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect
Are you sure your DB installation is using 27017 as port? If so, are you sure external access is allowed to this port and/or to the DB itself?
 
Upvote 0

lucdrb

Active Member
Licensed User
Longtime User
Unfortunately:


The DB don't have password or user name, I didn't fix any

Are you sure your DB installation is using 27017 as port? If so, are you sure external access is allowed to this port and/or to the DB itself?

I have access to it on the computer where it's installed


But I don't know how to reach it in remote on the 192.168.0.33 adress

Thank for your help.

Luc
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

lucdrb

Active Member
Licensed User
Longtime User
@OlivierA
Many thanks for your help.
Connection made.
I can go further with the study of B4J and MongoDB

Luc
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…