Question

Database connections retrieve parameters programmatically

  • 27 March 2019
  • 7 replies
  • 30 views

Badge +5

Hi,

I'm thinking if use database connections are better than published parameters or privates one and use it in embed connections. Database connections are usefull in case of maintenance, but I think are less usable as embed parameters.

The main question is about accessing database connection parameters from other transformers or from attributes (programmatically i.e. python). I'd like to use the host parameter set in database connection parameter for setting other variables and have a dynamic workbench in function of the host value.

With classical embed parameters is easy but with embed connections I think that is not possible.

I hope my question is clear.

Thank you for any suggestions about it.

Regards

Giosia

 


7 replies

Badge +2

@giosp Just to clarify your question. When you create a database or web connection you can choose between:

- Embed Connection Parameters

- Add Database Connection...

as shown below.

If you embed connection parameters, you can publish any of the connection parameters as a public or private parameters:

If you add a database connection, then the only parameter you can publish is the connection name.

If you embed your connection parameters, you should be able to publish the Host name and use that published parameter in a scripted parameter or other readers and transformers.

Badge +5

Hi @markatsafe,

sorry for my mistake... I've made confusion about embed connection parameters and database connections (fme desktop/server)... I was speaking about database connection and not about embed connection parameter. I've corrected my post. Embed connection parameters were for me embedded in fme desktop (sotred in the application)... Unhappy word to describe variables.

 

So the correct answer is that database connection are simply linked with a parameter and I can read the name as string format. With this I'm happy because I can understand if I'm in test or in production.

It could be fine to have the possibility to access to parameters as in example:

myconnectionName.host
myconnectionName.port

I use host information for establish a connection in other part of the workbench as SystemCaller Transformer.

Thank you

giosia

Badge +2

@giosp Thanks for the clarification. I have made this an Idea so other users can add their comments. Please vote and add any additional comments.

Badge +2

Hi @markatsafe,

sorry for my mistake... I've made confusion about embed connection parameters and database connections (fme desktop/server)... I was speaking about database connection and not about embed connection parameter. I've corrected my post. Embed connection parameters were for me embedded in fme desktop (sotred in the application)... Unhappy word to describe variables.

 

So the correct answer is that database connection are simply linked with a parameter and I can read the name as string format. With this I'm happy because I can understand if I'm in test or in production.

It could be fine to have the possibility to access to parameters as in example:

myconnectionName.host
myconnectionName.port

I use host information for establish a connection in other part of the workbench as SystemCaller Transformer.

Thank you

giosia

@giosp Thanks for the clarification. I have made this an Idea so other users can add their comments. Please vote and add any additional comments.

Badge +5

Thank you.

I also tried to create a new reader using embed connection parameters for db connections. It doesn't allow me to use any published or private parameters to set up the connection host/username/password. Below is my screenshot and I am using the MacOS version:

Badge +10

I also tried to create a new reader using embed connection parameters for db connections. It doesn't allow me to use any published or private parameters to set up the connection host/username/password. Below is my screenshot and I am using the MacOS version:

Hi @wechin,

 

You'll first need to create the embedded connection and have a reader added to your workspace.

 

Then you can edit the reader and be able to create parameters for the host/username/password etc.

Reply