Skip to main content
Question

SSL parameter on mongo connection


Forum|alt.badge.img

Hi !

 

 

I'm trying to create a database connection to a cosmosdb database using the mongodb api.

 

This implies using a mongodb connection with ssl parameter.

 

 

I can't find the ssl parameter in the mongo connection box in both FME 2016 and FME 2017, Is it not implemented yet ? Is there a way to connect providing the mongodb connection uri with any parameter ?

6 replies

geosander
Forum|alt.badge.img+7
  • October 9, 2017

Hi @vchalmel,

Firstly, do you have to use MongoDB to connect to Cosmos? Or can you also use another way to connect? If so, please ignore the sentences below and only read the last paragraph of my answer.

The MongoDB Server field (which is the only mandatory field) in the Add Database Connection dialog (when set to MongoDB of course) also allows for a complete connection string. You can set a lot of things in this connection string and one of the available options is SSL. So you could try to connect using a string like this:

mongodb://db1.example.net:2500/?ssl=true

I haven't used FME's MongoDB Reader/Writer for a while now. The replicaSet option, for instance, never worked in FME < 2017, so I'm not sure which options are supported or not, but SSL seems a pretty basic one to support... However, if the SSL option does not work, you could retry one more time adding another option to the connection string:

mongodb://db1.example.net:2500/?ssl=true&sslverifycertificate;=false

If that doesn't work, then I'm afraid it's not supported (yet)...

In that case, you might also want to try connecting to Cosmos DB using their DocumentDB API, since that Reader/Writer is also supported by FME and probably takes a more native approach.


Forum|alt.badge.img
  • Author
  • October 9, 2017
geosander wrote:

Hi @vchalmel,

Firstly, do you have to use MongoDB to connect to Cosmos? Or can you also use another way to connect? If so, please ignore the sentences below and only read the last paragraph of my answer.

The MongoDB Server field (which is the only mandatory field) in the Add Database Connection dialog (when set to MongoDB of course) also allows for a complete connection string. You can set a lot of things in this connection string and one of the available options is SSL. So you could try to connect using a string like this:

mongodb://db1.example.net:2500/?ssl=true

I haven't used FME's MongoDB Reader/Writer for a while now. The replicaSet option, for instance, never worked in FME < 2017, so I'm not sure which options are supported or not, but SSL seems a pretty basic one to support... However, if the SSL option does not work, you could retry one more time adding another option to the connection string:

mongodb://db1.example.net:2500/?ssl=true&sslverifycertificate;=false

If that doesn't work, then I'm afraid it's not supported (yet)...

In that case, you might also want to try connecting to Cosmos DB using their DocumentDB API, since that Reader/Writer is also supported by FME and probably takes a more native approach.

I will give it a try !

 

 


Forum|alt.badge.img
  • Author
  • October 10, 2017
geosander wrote:

Hi @vchalmel,

Firstly, do you have to use MongoDB to connect to Cosmos? Or can you also use another way to connect? If so, please ignore the sentences below and only read the last paragraph of my answer.

The MongoDB Server field (which is the only mandatory field) in the Add Database Connection dialog (when set to MongoDB of course) also allows for a complete connection string. You can set a lot of things in this connection string and one of the available options is SSL. So you could try to connect using a string like this:

mongodb://db1.example.net:2500/?ssl=true

I haven't used FME's MongoDB Reader/Writer for a while now. The replicaSet option, for instance, never worked in FME < 2017, so I'm not sure which options are supported or not, but SSL seems a pretty basic one to support... However, if the SSL option does not work, you could retry one more time adding another option to the connection string:

mongodb://db1.example.net:2500/?ssl=true&sslverifycertificate;=false

If that doesn't work, then I'm afraid it's not supported (yet)...

In that case, you might also want to try connecting to Cosmos DB using their DocumentDB API, since that Reader/Writer is also supported by FME and probably takes a more native approach.

Don't you get the error : "Cannot connect: More than one ':' detected. If this is an ipv6 address, it needs to be surrounded by '[' and ']';" ?

 

 


geosander
Forum|alt.badge.img+7
  • October 10, 2017
vchalmel wrote:
Don't you get the error : "Cannot connect: More than one ':' detected. If this is an ipv6 address, it needs to be surrounded by '[' and ']';" ?

 

 

I don't get anything, since I don't use MongoDB anymore and don't have access to an instance... ;)

 

Try to remove the port (set it in the proper field) and mongodb:// protocol prefix. So like this for example:

 

db1.example.net/?ssl=true

 

 

If that doesn't work, it's probably not supported...

 

If you desperately need MongoDB connectivity, you can also resort to the PythonCaller, using the pymongo or mongoengine libraries, for instance. I have some good experiences with those, since FME didn't support replica sets (like I mentioned above).

 


geosander
Forum|alt.badge.img+7
  • October 10, 2017
vchalmel wrote:
Don't you get the error : "Cannot connect: More than one ':' detected. If this is an ipv6 address, it needs to be surrounded by '[' and ']';" ?

 

 

Hi @vchalmel,

 

I've created a dummy instance (on mLab) and I can now confirm that the SSL switch is not supported by FME. Sorry for that...

 

If you'd like to use the standard DB connection technique that FME offers, you might want to contact Safe. Maybe they know a workaround for you!

 

If you'd like to take the Python route: I can help you out with that.

 

Sander

 


Forum|alt.badge.img
  • Author
  • October 11, 2017
geosander wrote:
Hi @vchalmel,

 

I've created a dummy instance (on mLab) and I can now confirm that the SSL switch is not supported by FME. Sorry for that...

 

If you'd like to use the standard DB connection technique that FME offers, you might want to contact Safe. Maybe they know a workaround for you!

 

If you'd like to take the Python route: I can help you out with that.

 

Sander

 

Thanks, I already used python for most mongodb tasks anyway since FME 2016 hadn't implemented the update api ^^

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings