Question

SSL parameter on mongo connection

  • 9 October 2017
  • 6 replies
  • 11 views

Badge

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

Badge +7

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.

Badge

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 !

 

 

Badge

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 ']';" ?

 

 

Badge +7
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).

 

Badge +7
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

 

Badge
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 ^^

 

 

Reply