Skip to main content
1-Visitor
August 17, 2020
Solved

configuring jdbc string dynamically

  • August 17, 2020
  • 3 replies
  • 1858 views

Hi,

I have a database template thing and is it possible to configure the jdbc connection string dynamically from the mashup? When a mashup is loaded, is it possible to pass the database name, username and password as input to establish the connection between that database and thing?

 

Thanks,

Shalini V.

Best answer by mnarang

The JDBC settings are stored in configuration table in Thingworx and you can get/set them using the get/setconfigurationtable snippet on the DB thing. There is also an example given here:
https://community.ptc.com/t5/IoT-Tech-Tips/Steps-to-create-a-External-Relational-Database-Thing-and-update/m-p/534858/highlight/false#M574

 

 

Thanks,

Mukul Narang

3 replies

5-Regular Member
August 17, 2020

Hello @svisveswaraiya_285988,

 

Yes, this is definitely possible. Please refer to Setting Configuration tab values on Things via a custom Service in ThingWorx for more information.

In summary, you need to navigate to your Database Thing > Services > GetConfigurationTables. This will return all the Configuration Tables available for that specific Thing, depending on the template. Then, run GetConfigurationTable for the specific table you are looking for more information about. In this case, we are looking at ConnectionInfo, per the image below:

 

ConfigTable.PNG

 

This allows you to create a Data Shape from the returned values by clicking the + Data Shape button on the top right corner of the screen. Then, all you need to do is setup your service to run SetConfigurationTable and passing the table name (ConnectionInfo) and an infotable with a row containing the information sent from the UI.

I hope you find this information helpful in setting configuration tables dynamically in runtime.

Regards,

Emmanuel

mnarang5-Regular MemberAnswer
5-Regular Member
August 17, 2020

The JDBC settings are stored in configuration table in Thingworx and you can get/set them using the get/setconfigurationtable snippet on the DB thing. There is also an example given here:
https://community.ptc.com/t5/IoT-Tech-Tips/Steps-to-create-a-External-Relational-Database-Thing-and-update/m-p/534858/highlight/false#M574

 

 

Thanks,

Mukul Narang

Support
September 16, 2020

Hi @svisveswaraiya_285988.

 

If you feel your question has been answered, please mark the appropriate post as the Accepted Solution for the benefit of others with the same question.

 

Thank you for your participation in our community!

 

Regards.

 

--Sharon